Spec-Zone .ru
спецификации, руководства, описания, API
|
CONTENTS | PREV | NEXT | Java Remote Method Invocation |
Unreferenced
Interface
package java.rmi.server; public interface Unreferenced { public void unreferenced(); }
Thejava.rmi.server.Unreferenced
interface allows a server object to receive notification that there are no clients holding remote references to it. The distributed garbage collection mechanism maintains for each remote object, the set of client virtual machines that hold references to that remote object. As long as some client holds a remote reference to the remote object, the RMI runtime keeps a local reference to the remote object. Each time the remote object's "reference" set becomes empty (meaning that the number of clients that reference the object becomes zero), theUnreferenced.unreferenced
method is invoked (if that remote object implements theUnreferenced
interface). A remote object is not required to support theUnreferenced
interface.As long as some local reference to the remote object exists, it may be passed in remote calls or returned to clients. The process that receives the reference is added to the reference set for the remote object. When the reference set becomes empty, the remote object's
unreferenced
method will be invoked. As such, theunreferenced
method can be called more than once (each time the set is newly emptied). Remote objects are only collected when no more references, either local references or those held by clients, still exist.