register

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

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

Parameters

obj

the object to monitor

action

a Runnable to invoke when the object becomes phantom reachable