Exception handling in JNI

Explain Exception handling in JNI.

There are two ways to handle an exception in native code:

-The native method can choose to return immediately, causing the exception to be thrown in the Java code that initiated the native method call.

-The native code can clear the exception by calling ExceptionClear (), and then execute its own exception-handling code. After an exception has been raised, the native code must first clear the exception before making other JNI calls. When there is a pending exception, the only JNI functions that are safe to call are ExceptionOccurred (),ExceptionDescribe (), and ExceptionClear (). The ExceptionDescribe () function prints a debugging message about the pending exception.
Advantages and disadvantages of using JNI
Advantages of JNI: 1. JNI enables one to write programs in native language or method when an application cannot be written entirely in the Java programming language...
Difference between ServletsContext and ServletConfig
ServletConfig: It defines how a servlet is configured. ServletConfig is implemented by the servlet container to initialize a single servlet using init ()....
Why is HTTP protocol called as a stateless protocol?
HTTP is called a stateless protocol because in this each command is executed independently, without any knowledge of the commands...
Post your comment