Package org.python.core.finalization
Class FinalizeTrigger
java.lang.Object
org.python.core.finalization.FinalizeTrigger
To use finalizers on
PyObjects, read the documentation of
FinalizablePyObject.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic FinalizeTriggerFactoryThis factory hook is reserved for use by JyNI.static final byteIndicates that this trigger was already finalized.bytestatic final byteIndicates that the underlying PyObject was never intended to be finalized.static final byteThis flag tells the finalize trigger to callgc.notifyFinalize(PyObject)after it called the finalizer.static final byteIndicates that onlyFinalizableBuiltinshall be called. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidvoidclear()static voidensureFinalizer(PyObject resurrect) Recreates theFinalizeTriggerof the given object.static booleanhasActiveTrigger(PyObject obj) booleanisActive()static booleanisFinalizable(PyObject obj) booleanstatic FinalizeTriggermakeTrigger(PyObject toFinalize) voidstatic voidrunFinalizer(PyObject toFinalize) static voidrunFinalizer(PyObject toFinalize, boolean runBuiltinOnly) void
-
Field Details
-
NOTIFY_GC_FLAG
public static final byte NOTIFY_GC_FLAGThis flag tells the finalize trigger to callgc.notifyFinalize(PyObject)after it called the finalizer.- See Also:
-
NOT_FINALIZABLE_FLAG
public static final byte NOT_FINALIZABLE_FLAGIndicates 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:
-
ONLY_BUILTIN_FLAG
public static final byte ONLY_BUILTIN_FLAGIndicates that onlyFinalizableBuiltinshall be called.- See Also:
-
FINALIZED_FLAG
public static final byte FINALIZED_FLAGIndicates that this trigger was already finalized.- See Also:
-
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 Details
-
makeTrigger
-
hasActiveTrigger
-
isFinalizable
-
ensureFinalizer
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
-
runFinalizer
-
appendFinalizeTriggerForBuiltin
-
clear
public void clear() -
trigger
-
isActive
public boolean isActive() -
performFinalization
public void performFinalization() -
isFinalized
public boolean isFinalized()
-