The first call of this method starts the internal thread in this object. This thread will look, in an infinite loop, for the levels of reachability of all objects passed to this method as checkedForDeallocation argument, and will call corresponding tasks when these objects will become phantomly reachable.
Important: the implementation of task must not contain references to the passed checkedForDeallocation instance! In other case, this instance will never become unreachable and task.run() method will never be called.
Note: if the class of checkedForDeallocation object, or the class of the last object which allows to reach checkedForDeallocation, declares standard finalize() method, then the task may not be called while the first System.gc() call after the moment when checkedForDeallocation object will become phantomly reachable, but only while second or further System.gc() calls. @param checkedForDeallocation some object. @param task a task thah will be performed on deallocationof checkedForDeallocation object.
|
|
|
|
|
|