Centralized management of
JNI handles for Java objects. There are
different kinds of JNI handles and the main purpose of this class is to abstract their
differences when working with handles. In order to do that efficiently, we partition the value
range of the word-sized handles into subranges for the different kinds:
- Local handles as defined in the JNI specification can be created and released implicitly or
explicitly and are valid only in the current thread.
- Global handles as defined in the JNI specification must be created explicitly and are valid
in the entire isolate until they are explicitly released. Individual global handles can be weak,
in which case they don't prevent garbage collection of their target object. See:
JNIGlobalHandles
.
- Image heap handles refer to objects in the image heap. This handle type is specific to our
implementation. Handles can be either local, global or weak-global according to the JNI
specification, so they need some special treatment. See:
JNIImageHeapHandles
.