RMI : Remote Method Invocation
Why distributed object system.?
Large problems can be solved easily if they are split among two or more people. Distributed computing helps to solve large problems by splitting them. The split components are kept in different computers. Objects on remote systems can be accessed with the same ease as those on local systems.
Advantages of distributed object systems are scalability, minimizing bandwidth requirements and making it easier for the programmer by handling or hiding complexities across systems.
Stub:
The stub is an object, acts as a gateway for the client side. All the outgoing requests are routed through it. It resides at the client side and represents the remote object. When the caller invokes method on the stub object, it does the following tasks:
3 layers in RMI system:
1. Stub – proxy for remote object.
Skeleton – remote proxy
for object.
2.Remote reference layer -Supports communication between stub and skeleton.
3.Transport Layer - Sets up and manages connections
between different JVMs.
Stub and Skeleton Layers
Why distributed object system.?
Large problems can be solved easily if they are split among two or more people. Distributed computing helps to solve large problems by splitting them. The split components are kept in different computers. Objects on remote systems can be accessed with the same ease as those on local systems.
Advantages of distributed object systems are scalability, minimizing bandwidth requirements and making it easier for the programmer by handling or hiding complexities across systems.
- RMI allows objects in one JVM to invoke methods of objects in another JVM.
- Distributed object systems require that objects running in different address spaces be able to communicate with each other.
The stub is an object, acts as a gateway for the client side. All the outgoing requests are routed through it. It resides at the client side and represents the remote object. When the caller invokes method on the stub object, it does the following tasks:
- It initiates a connection with remote Virtual Machine (JVM),
- It writes and transmits (marshals) the parameters to the remote Virtual Machine (JVM),
- It waits for the result
- It reads the return value or exception, and
- It finally, returns the value to the caller.
Skeleton:
The skeleton is an object, acts as a gateway for the server side object. All the incoming requests are routed through it. When the skeleton receives the incoming request, it does the following tasks:- It reads the parameter for the remote method
- It invokes the method on the actual remote object, and
- It writes and transmits the result to the caller.
3 layers in RMI system:
1. Stub – proxy for remote object.
Skeleton – remote proxy
for object.
2.Remote reference layer -Supports communication between stub and skeleton.
3.Transport Layer - Sets up and manages connections
between different JVMs.
RMI architecture
- A client needs a reference to the remote object to invoke any of its methods.
- Invocation passes from stub to remote reference layer to transport layer.
- Transport layer contacts the skeleton through remote reference layer on the server.
- Skeleton checks remote registry to see whether the object is registered.
- If registered, the object method is passed to the stub using remote reference layer and transport layer and then to the client object.
Remote Reference Layer
- Responsible for unicast point-to-point method invocation.
- It defines the number of connections that can be made to a server object depending on the load on the server object.
- May deactivate an object and store the data of the object in a file or a database.
- If the server is down, try to look out for alternatives to fulfill a request.
Transport layer
- RMI uses TCP/IP to communicate between client and server transport layers.
- It uses socket to communicate between the client and server transport layer.
- Transport layer can implement TCP and UDP protocols.
- Transport layer takes care of multiple connections from the client.
No comments:
Post a Comment