Jini and Network Computing/Subclassing the UnicastRemoteObject class

From Wikibooks, open books for an open world
< Jini and Network Computing
Jump to: navigation, search

When using the JRMP mechanisms provided in the java.rmi package, the java.rmi.UnicastRemoteObject class can be subclassed to get some simple programming tasks done for you.

In Jini2.0 and later, the use of net.jini.export.Exporter implementations, requires that subclassing not be performed, and instead, explicit exporting and unexporting be done. There are several important points about this.

  1. Each place that a remote object leaves the VM might need to explicitly export, and manage the lifecycle of the remote object returned by the exporter.
  2. If there is local and remote use of the same object, you might need to keep two different references around, one for local use, and one that will be passed out of the VM for remote use unless #1 applies, in which case, you can just export as needed.

Set the section on Using Jini Exporters for more information.