Package org.python.core.finalization
Class FinalizeTrigger
java.lang.Object
org.python.core.finalization.FinalizeTrigger
To use finalizers on
PyObject
s, read the documentation of
FinalizablePyObject
.-
Field Summary
Modifier and TypeFieldDescriptionstatic FinalizeTriggerFactory
This factory hook is reserved for use by JyNI.static final byte
Indicates that this trigger was already finalized.byte
static final byte
Indicates that the underlying PyObject was never intended to be finalized.static final byte
This flag tells the finalize trigger to callgc.notifyFinalize(PyObject)
after it called the finalizer.static final byte
Indicates that onlyFinalizableBuiltin
shall be called. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
void
clear()
static void
ensureFinalizer
(PyObject resurrect) Recreates theFinalizeTrigger
of the given object.static boolean
hasActiveTrigger
(PyObject obj) boolean
isActive()
static boolean
isFinalizable
(PyObject obj) boolean
static FinalizeTrigger
makeTrigger
(PyObject toFinalize) void
static void
runFinalizer
(PyObject toFinalize) static void
runFinalizer
(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 notifygc
that 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 onlyFinalizableBuiltin
shall 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 theFinalizeTrigger
of 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()
-