register

open fun register(obj: Any, action: Runnable)

Registers an object and a cleaning action to run when the object becomes phantom reachable.

Parameters

action

a to invoke when the object becomes phantom reachable

obj

the object to monitor