Package org.h2.util
Class TempFileDeleter
java.lang.Object
org.h2.util.TempFileDeleter
This class deletes temporary files when they are not used any longer.
-
Method Summary
Modifier and TypeMethodDescriptionReference<?> Add a file or a closeable to the list of temporary objects to delete.voidDelete all registered temp resources.voiddeleteFile(Reference<?> ref, Object resource) Delete the given file or close the closeable now.voidDelete all unused resources now.static TempFileDeletervoidstopAutoDelete(Reference<?> ref, Object resource) This method is called if a file should no longer be deleted or a resource should no longer be closed if the object is garbage collected.
-
Method Details
-
getInstance
-
addFile
Add a file or a closeable to the list of temporary objects to delete. The file is deleted once the file object is garbage collected.- Parameters:
resource- the file name or the closeablemonitor- the object to monitor- Returns:
- the reference that can be used to stop deleting the file or closing the closeable
-
deleteFile
Delete the given file or close the closeable now. This will remove the reference from the list.- Parameters:
ref- the reference as returned by addFileresource- the file name or closeable
-
deleteAll
public void deleteAll()Delete all registered temp resources. -
deleteUnused
public void deleteUnused()Delete all unused resources now. -
stopAutoDelete
This method is called if a file should no longer be deleted or a resource should no longer be closed if the object is garbage collected.- Parameters:
ref- the reference as returned by addFileresource- file name or closeable
-