Package com.avpkit.ferry
Class JNINativeFinalizer
- java.lang.Object
-
- com.avpkit.ferry.JNINativeFinalizer
-
public final class JNINativeFinalizer extends java.lang.Object
Internal Only. This class is held on to by theRefCountedclasses and nulled when that object is collected. It has no references to any (non static) members and so itsfinalize()method will not hold up the collection of any other object.It exists so that we still have a mechanism that always frees native memory; in most cases the
JNIReferencewill enqueue correctly with theJNIMemoryManager, and then the next call to a Ferry based method will drain that queue, but sometimes there is no extra call to one of those methods; in this case we'll drain the queue when this gets finalized.It does a
JNIMemoryManager.gc()which might race with theJNIMemoryManager.gc()that aJNIReferencedoes on allocation of a new object but that's a safe race.- Author:
- aclarke
-
-
Constructor Summary
Constructors Constructor Description JNINativeFinalizer()Internal Only.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidfinalize()Runs aJNIMemoryManager.gc()to free up anyRefCountedobjects that are pending release.
-
-
-
Constructor Detail
-
JNINativeFinalizer
public JNINativeFinalizer()
Internal Only. Creates a newJNINativeFinalizer. This object must contain no references to any other objects in the system.
-
-
Method Detail
-
finalize
protected void finalize()
Runs aJNIMemoryManager.gc()to free up anyRefCountedobjects that are pending release.- Overrides:
finalizein classjava.lang.Object
-
-