releaseElementsCritical

The semantics of this function is very similar to the releaseElements.

Informs the VM that the native code no longer needs access to carray. The carray argument is a pointer derived from the receiver using the getElementsCritical function. If necessary, this function copies back all changes made to elems to the original array.

The mode argument provides information on how the array buffer should be released. mode has no effect if carray is not a copy of the elements in the receiver. Otherwise, mode has the following impact:

After calling getElementsCritical, the native code should not run for an extended period of time before it calls releaseElementsCritical. We must treat the code inside this pair of functions as running in a "critical region." Inside a critical region, native code must not call other JNI functions or any system call that may cause the current thread to block and wait for another Java thread. (For example, the current thread must not call read on a stream being written by another Java thread.)

These restrictions make it more likely that the native code will get an uncopied version of the array, even if the VM does not support pinning. For example, a VM may temporarily disable garbage collection when the native code is holding a pointer to an array obtained via getElementsCritical.

Since

JDK/JRE 1.2