I have been implementing an RMI client/server system which needs to detect when clients are finished with their remote references. On Windows, the clients set the reference to null and call system.gc() which invokes the unreferenced method on the server. Under solaris however the unreferenced() method is not called (even if System.runFinalization() is called). Any ideas why?

Edward Harned

  1. The unrferenced() method is only called when ALL clients no longer hold a reference to the remote object or when the lease time expires, (java.rmi.dgc.leaseValue.)
  2. The Registries, (RMI/JNDI) are clients. If you register your remote object with one of these, then your unreferenced() method will never be called.
  3. Since this is the purview of the Distributed Garbage Collector, each operating system may implement this differently.

We sell a framework for RMI Servers. We do not implement the Unreferenced interface.

We keep track of the idle period, that is - the time when no Client has called the Server. When this idle period reaches a threshold, the application may take some action, (such as deactivating, etc.)  In this way, we are not dependent on any implementations of DGC and we have much more flexibility.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact