Class HSObject
java.lang.Object
org.graalvm.jniutils.HSObject
Encapsulates a JNI handle to an object in the HotSpot heap. Depending on which constructor is
used, the handle is either local to a
JNIMethodScope and thus invalid once the scope
exits or a global JNI handle that is only released sometime after the HSObject dies.-
Constructor Summary
ConstructorsConstructorDescriptionHSObject(JNI.JNIEnv env, JNI.JObject handle) Creates an object encapsulating ahandlewhose lifetime is determined by this object.HSObject(JNI.JNIEnv env, JNI.JObject handle, boolean allowGlobalDuplicates, boolean weak) Creates an object encapsulating ahandlewhose lifetime is determined by this object.HSObject(JNIMethodScope scope, JNI.JObject handle) Creates an object encapsulating ahandlewhose lifetime is limited toscope. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcleanHandles(JNI.JNIEnv env) ProcessesCLEANERS_QUEUEto release any handles whose objects are now unreachable.final JNI.JObjectfinal voidrelease(JNI.JNIEnv env) toString()
-
Constructor Details
-
HSObject
Creates an object encapsulating ahandlewhose lifetime is determined by this object. The createdHSObjectuses a JNI global reference and does not allow duplicate JNI references. UseHSObject(JNIEnv, JObject, boolean, boolean)to createHSObjectusing a JNI weak reference or allowing duplicate JNI references. -
HSObject
Creates an object encapsulating ahandlewhose lifetime is determined by this object. The createdHSObjectpossibly allows duplicate JNI global handles. -
HSObject
Creates an object encapsulating ahandlewhose lifetime is limited toscope. Oncescope.close()is called, any attempt to use the handle will result in anIllegalArgumentException.
-
-
Method Details
-
getHandle
-
toString
-
release
-
cleanHandles
ProcessesCLEANERS_QUEUEto release any handles whose objects are now unreachable.
-