Class JNIConfig.Builder
java.lang.Object
org.graalvm.nativebridge.JNIConfig.Builder
- Enclosing class:
JNIConfig
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds theJNIConfig.static BinaryMarshaller<StackTraceElement[]> Returns aBinaryMarshallerfor stack trace marshalling.registerMarshaller(Class<T> type, Class<? extends Annotation> annotationType, BinaryMarshaller<T> marshaller) registerMarshaller(Class<T> type, BinaryMarshaller<T> marshaller) Registers aBinaryMarshallerfor thetype.registerMarshaller(TypeLiteral<T> parameterizedType, Class<? extends Annotation> annotationType, BinaryMarshaller<T> marshaller) registerMarshaller(TypeLiteral<T> parameterizedType, BinaryMarshaller<T> marshaller) Registers aBinaryMarshallerfor theparameterizedType.Registers a callback used by theNativeIsolateto attach the current thread to an isolate.Registers a callback used by theNativeIsolateto detach the current thread from an isolate.setNativeThreadLocalFactory(Function<Supplier<NativeIsolateThread>, ThreadLocal<NativeIsolateThread>> factory) Registers a thread local factory whenever the default thread local handling should be overriden.Registers a callback used by theNativeObjectto free an object in a native image heap referenced by the garbage-collected handle.Registers a callback used by theNativeIsolateto tear down the isolate.
-
Method Details
-
registerMarshaller
Registers aBinaryMarshallerfor thetype.- Parameters:
type- the type to registerBinaryMarshallerfor.marshaller- the marshaller to register.
-
registerMarshaller
public <T> JNIConfig.Builder registerMarshaller(TypeLiteral<T> parameterizedType, BinaryMarshaller<T> marshaller) Registers aBinaryMarshallerfor theparameterizedType.- Parameters:
parameterizedType- the type to registerBinaryMarshallerfor.marshaller- the marshaller to register.
-
registerMarshaller
public <T> JNIConfig.Builder registerMarshaller(Class<T> type, Class<? extends Annotation> annotationType, BinaryMarshaller<T> marshaller) - Parameters:
type- the type to registerBinaryMarshallerfor.annotationType- a required annotation to look up the marshaller.marshaller- the marshaller to register.
-
registerMarshaller
public <T> JNIConfig.Builder registerMarshaller(TypeLiteral<T> parameterizedType, Class<? extends Annotation> annotationType, BinaryMarshaller<T> marshaller) - Parameters:
parameterizedType- the type to registerBinaryMarshallerfor.annotationType- a required annotation to look up the marshaller.marshaller- the marshaller to register.
-
setAttachThreadAction
Registers a callback used by theNativeIsolateto attach the current thread to an isolate.- Parameters:
action- aLongUnaryOperatorthat takes an isolate address as a parameter and returns the isolate thread address.
-
setDetachThreadAction
Registers a callback used by theNativeIsolateto detach the current thread from an isolate.- Parameters:
action- aLongUnaryOperatorthat takes an isolate thread address as a parameter and returns0on success or non-zero in case of an error.
-
setShutDownIsolateAction
Registers a callback used by theNativeIsolateto tear down the isolate.- Parameters:
action- aLongBinaryOperatorthat takes an isolate address and an isolate thread address as parameters and returns0on success or non-zero in case of an error.
-
setReleaseNativeObjectAction
Registers a callback used by theNativeObjectto free an object in a native image heap referenced by the garbage-collected handle. At some point after aNativeObjectis garbage collected, a call to theactionis made to release the corresponding object in the native image heap.- Parameters:
action- aLongBinaryOperatorthat takes an isolate thread address and object handle as parameters and returns0on success or non-zero in case of an error.- See Also:
-
setNativeThreadLocalFactory
public JNIConfig.Builder setNativeThreadLocalFactory(Function<Supplier<NativeIsolateThread>, ThreadLocal<NativeIsolateThread>> factory) Registers a thread local factory whenever the default thread local handling should be overriden. This can be useful to install a terminating thread local using JVMCI services when needed.- See Also:
-
build
-
defaultStackTraceMarshaller
Returns aBinaryMarshallerfor stack trace marshalling.
-