Discuss RMI architecture with suitable diagram and discus each layers in the architecture briefly.
The RMI system consists of three layers:
a) The stub/skeleton layer
b) The remote reference layer
c) The transport layer
The application layer sits on top of the RMI system.
By using a layered architecture each of the layers could be enhanced or replaced without affecting the rest of the system. For example, the transport layer could be replaced by a UDP/IP layer without affecting the upper layers.
a) Stub and Skeleton Layer
The stub/skeleton layer is the interface between the application layer and the rest of the RMI system. This layer does not deal with specifics of any transport, but transmits data to the remote reference layer by using marshaling. It also takes data from remote reference layer by using unmarshalling or demarshalling.
During communication between two machines through RPC or RMI, parameters are packed into a message and then sent over the network. This packing of parameters into a message is called marshalling. On the other side these packed parameters are unpacked from the message which is called unmarshalling.
A stub for a remote object is the client-side proxy for the remote object. Such a stub implements all the interfaces that are supported by the remote object implementation.
b) Remote Reference Layer
The remote reference layer defines and supports the invocation semantics of the RMI connection. This layer maintains the session during the method call. This layer provides a Remote Ref object that represents the link to the remote service implementation object. The stub objects use the invoke() method in RemoteRef to forward the method call. The RemoteRef object understands the invocation semantics for remote services.
c) Transport Layer
The Transport Layer makes the connection between JVMs. All connections are stream based network connections that use TCP/IP. Even if two JVMs are running on the same physical computer, they connect through their host computer's TCP/IP network protocol stack. (This is why you must have an operational TCP/IP configuration on your computer to run a RMI programs). The following diagram shows the unfettered use of TCP/IP connections between JVMs.
Comments
Post a Comment