Interface ObjectHandles


public interface ObjectHandles
Manages a set of ObjectHandles. The handles returned by create() are bound to the creating handle set, i.e., the handle can only be accessed and destroyed using the exact same handle set used for creation.
Since:
19.0
  • Method Details

    • getGlobal

      static ObjectHandles getGlobal()
      A set of handles that is kept alive globally.
      Since:
      19.0
    • create

      static ObjectHandles create()
      Creates a new set of handles. Objects are kept alive until the returned ObjectHandles instance gets unreachable.
      Since:
      19.0
    • create

      ObjectHandle create(Object object)
      Creates a handle to the specified object. The object is kept alive by the garbage collector at least until destroy(org.graalvm.nativeimage.ObjectHandle) is called for the returned handle. The object can be null.
      Since:
      19.0
    • get

      <T> T get(ObjectHandle handle)
      Extracts the object from a given handle.
      Since:
      19.0
    • destroy

      void destroy(ObjectHandle handle)
      Destroys the given handle. After calling this method, the handle must not be used anymore.
      Since:
      19.0