RMI Notes

By an interface that must extend the remote interface

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: object. by an interface that must extend the Remote interface. Object Implementation A local object is A remote object's behavior is executed by a implemented by its Java Java class that implements the remote class. interface. Object Creation A new instance of a local A new instance of a remote object is created on object is created by the new the host computer with the new operator. A operator. client cannot directly create a new remote object (unless using Java 2 Remote Object Activation). Object Access A local object is accessed A remote object is accessed via an object directly via an object reference variable which points to a proxy stub reference variable. implementation of the remote interface. References In a single JVM, an object A "remote reference" is a pointer to a proxy reference points directly at object (a "stub") in the local heap. That stub an object in the heap. contains information that allows it to connect to a remote object, which contains the implementation of the methods. Active References In a single JVM, an object is In a distributed environment, remote JVMs may considered "alive" if there is crash, and network connections may be lost. A at least one reference to it. remote object is considered to have an active remote reference to it if it has been accessed within a certain time period (the lease period). If all remote references have been explicitly dropped, or if all remote references have expired leases, then a remote object is available for distributed garbage collection. Finalization If an object implements the finalize() method, it is called before an object is reclaimed by the garbage collector. If a remote object implements the Unreferenced interface, the unreferenced method of that interface is called when all remote references have been dropped. Garbage Collection When all local references to an object have been dropped, an object becomes a candidate for garbage collection. The distributed garbage collector works with the local garbage collector. If there are no remote references and all local references to a remote object have been dropped, then it becomes a candidate for garbage collection through the normal means. Exceptions Exceptions are either Runtime exceptions or Exceptions. The Java compiler forces a program to handle all Exceptions. RMI forces programs to deal with any possible RemoteException objects that may be thrown. This was done to ensure the robustness of distributed applications. How RMI w orks • RMI uses a netw ork-based registry to keep track of the distributed objects. The server object makes a method available for remote invocation by binding it to a name in the registry. The client object, in turn, can check for availability of an object by looking up its 2 Manisha Akolkar INTERNATIONAL INSTITUTE OF INFORMATION TECHNOLOGY P-14, Pune Infotech Park, Hinjaw adi, Pune – 411 027 • • • • • • name in the registry. The registry acts as a limited central management point for RMI. The reg...
View Full Document

Ask a homework question - tutors are online