Class RessourceCleaner


  • public class RessourceCleaner
    extends Object
    The ressource cleaner handles the release of ressources after the garbage collector has maked objects unreachable.
    Author:
    royer
    • Constructor Detail

      • RessourceCleaner

        public RessourceCleaner()
    • Method Detail

      • register

        public static final void register​(Cleanable pCleanable)
        Registers a cleanable object. When this object is eventually garbage collected, the ressources associated to this object will be released by executing the cleaner runnable.
        Parameters:
        pCleanable - cleanable object for which ressources have to be released.
      • shutdown

        public static void shutdown()
      • whatsIn

        public static void whatsIn()
      • cleanNow

        public static void cleanNow()
        Forces the immediate cleaning of ressources after thei corresponding objects are marked for garbage collection.
      • preventCleaning

        public static void preventCleaning​(Runnable pRunnable)
        Prevents the cleaning of ressources for the duration of the execution of the provided runnable (executed synchronously by same thread as caller)
        Parameters:
        pRunnable - runnable
      • getNumberOfRegisteredObjects

        public static int getNumberOfRegisteredObjects()
        Returns the number of registered objects
        Returns:
        number of registered objects