Class FinalizeTrigger

java.lang.Object
org.python.core.finalization.FinalizeTrigger

public class FinalizeTrigger extends Object
To use finalizers on PyObjects, read the documentation of FinalizablePyObject.
  • Field Details

    • NOTIFY_GC_FLAG

      public static final byte NOTIFY_GC_FLAG
      This flag tells the finalize trigger to call gc.notifyFinalize(PyObject) after it called the finalizer.
      See Also:
    • 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 notify gc 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_FLAG
      Indicates that only FinalizableBuiltin shall be called.
      See Also:
    • FINALIZED_FLAG

      public static final byte FINALIZED_FLAG
      Indicates that this trigger was already finalized.
      See Also:
    • factory

      public static FinalizeTriggerFactory factory
      This factory hook is reserved for use by JyNI. It allows to replace the default FinalizeTrigger. JyNI needs it to support garbage collection.
    • flags

      public byte flags
  • Method Details

    • 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 the FinalizeTrigger 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()