Class ObjectCleaner


  • public final class ObjectCleaner
    extends java.lang.Object
    Allows a way to register some Runnable that will executed once there are no references to an Object anymore.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int getLiveSetCount()  
      static void register​(java.lang.Object object, java.lang.Runnable cleanupTask)
      Register the given Object for which the Runnable will be executed once there are no references to the object anymore.
      • Methods inherited from class java.lang.Object

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

      • register

        public static void register​(java.lang.Object object,
                                    java.lang.Runnable cleanupTask)
        Register the given Object for which the Runnable will be executed once there are no references to the object anymore. This should only be used if there are no other ways to execute some cleanup once the Object is not reachable anymore because it is not a cheap way to handle the cleanup.
      • getLiveSetCount

        public static int getLiveSetCount()