Class Finalizer


  • public class Finalizer
    extends java.lang.Object
    Framework to monitor arbitrary objects to see if they have been garbage collected, running one or more runnables when they have.
    • Constructor Summary

      Constructors 
      Constructor Description
      Finalizer()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addFinalizer​(java.lang.Object o, java.lang.Runnable r)
      Schedules a Runnable to be run after garbage collection of the object.
      static void clearFinalizers​(java.lang.Object o)
      Cancels any references scheduled to be run after garbage collection of the argument 'o'.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Finalizer

        public Finalizer()
    • Method Detail

      • addFinalizer

        public static void addFinalizer​(java.lang.Object o,
                                        java.lang.Runnable r)
        Schedules a Runnable to be run after garbage collection of the object. Note that the Runnable can't contain references to the object to be collected: it will disable garbage collection of the object.
        Parameters:
        o - The object to monitor for garbage collection
        r - The routine to be executed after GC-ing the object
      • clearFinalizers

        public static void clearFinalizers​(java.lang.Object o)
        Cancels any references scheduled to be run after garbage collection of the argument 'o'.
        Parameters:
        o - Object to cancel references for