Class Isolates

java.lang.Object
org.graalvm.nativeimage.Isolates

public final class Isolates extends Object
Support for the creation, access to, and tear-down of isolates.
Since:
19.0
  • Method Details

    • createIsolate

      public static IsolateThread createIsolate(Isolates.CreateIsolateParameters parameters) throws Isolates.IsolateException
      Creates a new isolate with the passed parameters. On success, the current thread is attached to the created isolate, and a pointer to its associated IsolateThread structure is returned.
      Parameters:
      parameters - Parameters for the creation of the isolate.
      Returns:
      A pointer to the structure that represents the current thread in the new isolate.
      Throws:
      Isolates.IsolateException - on error.
      Since:
      19.0
    • attachCurrentThread

      public static IsolateThread attachCurrentThread(Isolate isolate) throws Isolates.IsolateException
      Attaches the current thread to the passed isolate. If the thread has already been attached, the call provides the thread's existing isolate thread structure.
      Parameters:
      isolate - The isolate to which to attach the current thread.
      Returns:
      A pointer to the structure representing the newly attached isolate thread.
      Throws:
      Isolates.IsolateException - on error.
      Since:
      19.0
    • getCurrentThread

      public static IsolateThread getCurrentThread(Isolate isolate) throws Isolates.IsolateException
      Given an isolate to which the current thread is attached, returns the address of the thread's associated isolate thread structure. If the current thread is not attached to the passed isolate, returns null.
      Parameters:
      isolate - The isolate for which to retrieve the current thread's corresponding structure
      Returns:
      A pointer to the current thread's structure in the specified isolate or null if the thread is not attached to that isolate.
      Throws:
      Isolates.IsolateException - on error.
      Since:
      19.0
    • getIsolate

      public static Isolate getIsolate(IsolateThread thread) throws Isolates.IsolateException
      Given an isolate thread structure, determines to which isolate it belongs and returns the address of the isolate structure. May return null if the specified isolate thread structure is no longer valid.
      Parameters:
      thread - The isolate thread for which to retrieve the isolate.
      Returns:
      A pointer to the isolate, or null.
      Throws:
      Isolates.IsolateException - on error.
      Since:
      19.0
    • detachThread

      public static void detachThread(IsolateThread thread) throws Isolates.IsolateException
      Detaches the passed isolate thread from its isolate and discards any state or context that is associated with it. At the time of the call, no code may still be executing in the isolate thread's context. The passed pointer is no longer valid after the method returns.
      Parameters:
      thread - The isolate thread to detach from its isolate.
      Throws:
      Isolates.IsolateException - on error.
      Since:
      19.0
    • tearDownIsolate

      public static void tearDownIsolate(IsolateThread thread) throws Isolates.IsolateException
      Tears down an isolate. Given an IsolateThread for the current thread which must be attached to the isolate to be torn down, waits for any other attached threads to detach from the isolate, then discards the isolate's objects, threads, and any other state or context that is associated with it. The passed pointer is no longer valid after the method returns.
      Parameters:
      thread - IsolateThread of the current thread that is attached to the isolate which is to be torn down.
      Throws:
      Isolates.IsolateException - on error.
      Since:
      19.0