Top Description Inners Fields Constructors Methods
org.graalvm.nativebridge

public Class NativeObject

extends Object
Class Inheritance

Encapsulates a handle to an object in a native image heap where the object's lifetime is bound to the lifetime of the NativeObject instance. At some point, after a NativeObject is garbage collected, a call is made to release the handle, allowing the corresponding object in the native image heap to be collected.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final NativeObjectCleaner<NativeObject>
private final NativeIsolate
private final long

Constructor Summary

AccessConstructor and Description
public
NativeObject(NativeIsolate
an isolate in which an object referenced by the handle exists.
isolate
,
long
a handle to an object in a native image heap
objectHandle
)

Creates a new NativeObject.

Method Summary

Modifier and TypeMethod and Description
public final long
getHandle()

Returns a handle to an object in the native image heap.

public final NativeIsolate
getIsolate()

Returns an isolate in which an object referenced by this handle exists.

public final void
release()

Explicitly releases object in the native image heap referenced by this handle.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cleanupback to summary
private final NativeObjectCleaner<NativeObject> cleanup
isolateback to summary
private final NativeIsolate isolate
objectHandleback to summary
private final long objectHandle

Constructor Detail

NativeObjectback to summary
public NativeObject(NativeIsolate isolate, long objectHandle)

Creates a new NativeObject.

Parameters
isolate:NativeIsolate

an isolate in which an object referenced by the handle exists.

objectHandle:long

a handle to an object in a native image heap

Method Detail

getHandleback to summary
public final long getHandle()

Returns a handle to an object in the native image heap.

getIsolateback to summary
public final NativeIsolate getIsolate()

Returns an isolate in which an object referenced by this handle exists.

releaseback to summary
public final void release()

Explicitly releases object in the native image heap referenced by this handle. The use of this method should be exceptional. By default, the lifetime of the object in the native image heap is bound to the lifetime of the NativeObject instance.

org.graalvm.nativebridge back to summary

private final Class NativeObject.NativeObjectCleanerImpl

extends NativeObjectCleaner<NativeObject>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final long
Inherited from org.graalvm.nativebridge.NativeObjectCleaner:
isolate

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
cleanUp(long
the isolate thread address to call into isolate.
isolateThread
)

Implements abstract org.graalvm.nativebridge.NativeObjectCleaner.cleanUp.

At some point after a referent is garbage collected the NativeIsolate is entered and the cleanUp(long) is executed with the isolate thread address parameter.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from org.graalvm.nativebridge.NativeObjectCleaner:
processPendingCleanersregister

Field Detail

handleback to summary
private final long handle

Constructor Detail

NativeObjectCleanerImplback to summary
pack-priv NativeObjectCleanerImpl(NativeObject nativeObject)

Method Detail

cleanUpback to summary
public void cleanUp(long isolateThread)

Implements abstract org.graalvm.nativebridge.NativeObjectCleaner.cleanUp.

Doc from org.graalvm.nativebridge.NativeObjectCleaner.cleanUp.

At some point after a referent is garbage collected the NativeIsolate is entered and the cleanUp(long) is executed with the isolate thread address parameter. This method should perform cleanup in the isolate heap.

Parameters
isolateThread:long

the isolate thread address to call into isolate.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override