Register an object and a cleaning action to run when the object becomes phantom reachable.
public static CleaningService.Cleanablecreate(Object o,
Runnable action)
throws UnsupportedOperationException
Register an object and a cleaning action to run when the object becomes phantom reachable.
Parameters:
o - The object to monitor.
action - The action to run when o becomes phantom reachable.
Returns:
an object that can be used to explicitly run the cleaning action. If the cleaning action is run
explicitly, then it is not run again after the object becomes phantom reachable.
Throws:
UnsupportedOperationException - if this service is not supported.