Package org.python.core.finalization
Class FinalizeTrigger
- java.lang.Object
-
- org.python.core.finalization.FinalizeTrigger
-
public class FinalizeTrigger extends java.lang.Object
To use finalizers onPyObject
s, read the documentation ofFinalizablePyObject
.
-
-
Field Summary
Fields Modifier and Type Field Description static FinalizeTriggerFactory
factory
This factory hook is reserved for use by JyNI.static byte
FINALIZED_FLAG
Indicates that this trigger was already finalized.byte
flags
static byte
NOT_FINALIZABLE_FLAG
Indicates that the underlying PyObject was never intended to be finalized.static byte
NOTIFY_GC_FLAG
This flag tells the finalize trigger to callgc.notifyFinalize(PyObject)
after it called the finalizer.static byte
ONLY_BUILTIN_FLAG
Indicates that onlyFinalizableBuiltin
shall be called.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
appendFinalizeTriggerForBuiltin(PyObject obj)
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
isFinalized()
static FinalizeTrigger
makeTrigger(PyObject toFinalize)
void
performFinalization()
static void
runFinalizer(PyObject toFinalize)
static void
runFinalizer(PyObject toFinalize, boolean runBuiltinOnly)
void
trigger(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 notifygc
that 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 onlyFinalizableBuiltin
shall 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 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
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()
-
-