public abstract class NativeObjectCleaner<T> extends WeakReference<T>
NativeObjectCleaner.register() is called, or it can be performed explicitly
using NativeObjectCleaner.processPendingCleaners().| Modifier | Constructor and Description |
|---|---|
protected |
NativeObjectCleaner(T referent,
NativeIsolate isolate)
Creates a new
NativeObjectCleaner. |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
cleanUp(long isolateThread)
At some point after a
referent is garbage collected the NativeIsolate is
entered and the NativeObjectCleaner.cleanUp(long) is executed with the isolate thread address parameter. |
static void |
processPendingCleaners()
Performs an explicit clean up of enqueued
NativeObjectCleaners. |
NativeObjectCleaner<T> |
register()
Registers
NativeObjectCleaner for cleanup. |
clear, clone, enqueue, get, isEnqueued, reachabilityFenceprotected NativeObjectCleaner(T referent, NativeIsolate isolate)
NativeObjectCleaner.referent - object the new weak reference will refer toisolate - the native object isolatepublic final NativeObjectCleaner<T> register()
NativeObjectCleaner for cleanup.protected abstract void cleanUp(long isolateThread)
referent is garbage collected the NativeIsolate is
entered and the NativeObjectCleaner.cleanUp(long) is executed with the isolate thread address parameter.
This method should perform cleanup in the isolate heap.isolateThread - the isolate thread address to call into isolate.public static void processPendingCleaners()
NativeObjectCleaners.