Package com.storedobject.common
Class ResourceDisposal
java.lang.Object
com.storedobject.common.ResourceDisposal
Resource disposal class. Any
ResourceOwner
can statically register with this class so that its
"resource" will be automatically closed when it is garbage-collected.- Author:
- Syam
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Dump class names of the resources that are still not closed because their holders are not yet garbage collected.static void
gc()
Invoke JVM's garbage collector within the next 30 seconds.static void
register
(ResourceOwner resourceOwner) Register me so that my resource will get closed automatically when I am garbage collected.
-
Constructor Details
-
ResourceDisposal
public ResourceDisposal()
-
-
Method Details
-
register
Register me so that my resource will get closed automatically when I am garbage collected.- Parameters:
resourceOwner
- Owner of the resource.Null
values will be ignored.
-
dumpResources
public static void dumpResources()Dump class names of the resources that are still not closed because their holders are not yet garbage collected. This could be used for debugging purposes. -
gc
public static void gc()Invoke JVM's garbage collector within the next 30 seconds.
-