Class RessourceCleaner
- java.lang.Object
-
- net.haesleinhuepf.clij.coremem.rgc.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 Summary
Constructors Constructor Description RessourceCleaner()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcleanNow()Forces the immediate cleaning of ressources after thei corresponding objects are marked for garbage collection.static intgetNumberOfRegisteredObjects()Returns the number of registered objectsstatic voidpreventCleaning(Runnable pRunnable)Prevents the cleaning of ressources for the duration of the execution of the provided runnable (executed synchronously by same thread as caller)static voidregister(Cleanable pCleanable)Registers a cleanable object.static voidshutdown()static voidwhatsIn()
-
-
-
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
-
-