Package org.python.core.finalization
Class FinalizeTrigger
- java.lang.Object
-
- org.python.core.finalization.FinalizeTrigger
-
public class FinalizeTrigger extends java.lang.ObjectTo use finalizers onPyObjects, read the documentation ofFinalizablePyObject.
-
-
Field Summary
Fields Modifier and Type Field Description static FinalizeTriggerFactoryfactoryThis factory hook is reserved for use by JyNI.static byteFINALIZED_FLAGIndicates that this trigger was already finalized.byteflagsstatic byteNOT_FINALIZABLE_FLAGIndicates that the underlying PyObject was never intended to be finalized.static byteNOTIFY_GC_FLAGThis flag tells the finalize trigger to callgc.notifyFinalize(PyObject)after it called the finalizer.static byteONLY_BUILTIN_FLAGIndicates that onlyFinalizableBuiltinshall be called.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidappendFinalizeTriggerForBuiltin(PyObject obj)voidclear()static voidensureFinalizer(PyObject resurrect)Recreates theFinalizeTriggerof the given object.static booleanhasActiveTrigger(PyObject obj)booleanisActive()static booleanisFinalizable(PyObject obj)booleanisFinalized()static FinalizeTriggermakeTrigger(PyObject toFinalize)voidperformFinalization()static voidrunFinalizer(PyObject toFinalize)static voidrunFinalizer(PyObject toFinalize, boolean runBuiltinOnly)voidtrigger(PyObject toFinalize)
-
-
-
Field Detail
-
NOTIFY_GC_FLAG
public static final byte NOTIFY_GC_FLAG
This flag tells the finalize trigger to callgc.notifyFinalize(PyObject)after it called the finalizer.- See Also:
- Constant Field Values
-
NOT_FINALIZABLE_FLAG
public static final byte NOT_FINALIZABLE_FLAG
Indicates that the underlying PyObject was never intended to be finalized. It is actually not finalizable and the trigger only exists to notifygcthat the underlying object was finalized. This is needed for some advanced gc-functionality.- See Also:
- Constant Field Values
-
ONLY_BUILTIN_FLAG
public static final byte ONLY_BUILTIN_FLAG
Indicates that onlyFinalizableBuiltinshall be called.- See Also:
- Constant Field Values
-
FINALIZED_FLAG
public static final byte FINALIZED_FLAG
Indicates that this trigger was already finalized.- See Also:
- Constant Field Values
-
factory
public static FinalizeTriggerFactory factory
This factory hook is reserved for use by JyNI. It allows to replace the defaultFinalizeTrigger. JyNI needs it to support garbage collection.
-
flags
public byte flags
-
-
Method Detail
-
makeTrigger
public static FinalizeTrigger makeTrigger(PyObject toFinalize)
-
hasActiveTrigger
public static boolean hasActiveTrigger(PyObject obj)
-
isFinalizable
public static boolean isFinalizable(PyObject obj)
-
ensureFinalizer
public static void ensureFinalizer(PyObject resurrect)
Recreates theFinalizeTriggerof the given object. This makes sure that once the resurrected object is gc'ed again, its__del__-method will be called again.
-
runFinalizer
public static void runFinalizer(PyObject toFinalize)
-
runFinalizer
public static void runFinalizer(PyObject toFinalize, boolean runBuiltinOnly)
-
appendFinalizeTriggerForBuiltin
public static void appendFinalizeTriggerForBuiltin(PyObject obj)
-
clear
public void clear()
-
trigger
public void trigger(PyObject toFinalize)
-
isActive
public boolean isActive()
-
performFinalization
public void performFinalization()
-
isFinalized
public boolean isFinalized()
-
-