This section teaches you how to deal with exceptions from within a native method implementation. Your native method can catch, throw, and clear exceptions. Local and Global References Native code can refer to Java objects using either local or global references. Local references are only valid within a native method invocation. Local references are freed automatically after the native method returns.
Global references remain valid throughout an application.
You must explicitly allocate and free global references. This section describes the implications of running native methods in the multi-threaded Java platform. The JNI offers basic synchronization constructs for native methods.