Package uk.ac.ebi.utils.memory
Class CleaningObject
java.lang.Object
uk.ac.ebi.utils.memory.CleaningObject
- All Implemented Interfaces:
AutoCloseable
Simulates the old
finalize()
method in Java >= 9.
This is based on registering a new cleaner
when an instance of this class (or subclasses) is created, such cleaner invokes close()
,
which plays the same role of the old finalizer method.
This can be useful when you have a set of classes with an old finalize method, which you can
subclass, after having renamed finalize()
into close()
.
- Author:
- brandizi
- Date:
- 31 Mar 2020
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
CleaningObject
public CleaningObject()
-
-
Method Details
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-