Package org.graalvm.nativeimage
Class Isolates
java.lang.Object
org.graalvm.nativeimage.Isolates
Support for the creation, access to, and tear-down of isolates.
- Since:
- 19.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Parameters for the creation of an isolate.static final class
An exception thrown in the context of managing isolates.static interface
Identifies a protection domain for an isolate. -
Method Summary
Modifier and TypeMethodDescriptionstatic IsolateThread
attachCurrentThread
(Isolate isolate) Attaches the current thread to the passed isolate.static IsolateThread
createIsolate
(Isolates.CreateIsolateParameters parameters) Creates a new isolate with the passed parameters.static void
detachThread
(IsolateThread thread) Detaches the passed isolate thread from its isolate and discards any state or context that is associated with it.static IsolateThread
getCurrentThread
(Isolate isolate) Given an isolate to which the current thread is attached, returns the address of the thread's associated isolate thread structure.static Isolate
getIsolate
(IsolateThread thread) Given an isolate thread structure, determines to which isolate it belongs and returns the address of the isolate structure.static void
tearDownIsolate
(IsolateThread thread) Tears down an isolate.
-
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 associatedIsolateThread
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
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
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, returnsnull
.- 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
Given an isolate thread structure, determines to which isolate it belongs and returns the address of the isolate structure. May returnnull
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
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
Tears down an isolate. Given anIsolateThread
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
-