Package com.azure.core.util
Interface ReferenceManager
-
public interface ReferenceManager
-
-
Field Summary
Fields Modifier and Type Field Description static ReferenceManager
INSTANCE
The global instance ofReferenceManager
that should be used to maintain object references.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
register(Object object, Runnable cleanupAction)
Registers theobject
and the cleaning action to run once the object becomes phantom reachable.
-
-
-
Field Detail
-
INSTANCE
static final ReferenceManager INSTANCE
The global instance ofReferenceManager
that should be used to maintain object references.
-
-
Method Detail
-
register
void register(Object object, Runnable cleanupAction)
Registers theobject
and the cleaning action to run once the object becomes phantom reachable.The
cleanupAction
cannot have a reference to theobject
, otherwise the object will never be able to become phantom reachable.Exceptions thrown by
cleanupAction
are ignored.- Parameters:
object
- The object to monitor.cleanupAction
- The cleanup action to perform when theobject
becomes phantom reachable.- Throws:
NullPointerException
- If eitherobject
orcleanupAction
are null.
-
-