RMI (Remote Method Invocation) is a Java API that allows distributed applications to communicate and invoke methods on remote objects. It provides a mechanism for a client to invoke methods on a remote object running on a server, as if the object were running on the client's machine. RMI is based on the Java Remote Procedure Call (RPC) mechanism.
The architecture of RMI consists of the following components:
- Remote interface: This interface specifies the methods that can be invoked remotely by a client.
- Remote object: This object implements the remote interface and provides the methods that can be invoked remotely by a client.
- Stub: This object is responsible for marshalling the parameters of a remote method invocation and sending them to the server.
- Skeleton: This object is responsible for unmarshalling the parameters of a remote method invocation and invoking the method on the server.
- Registry: This is a service that allows clients to look up remote objects by name.
- Client: This is the application that invokes methods on a remote object.
- Server: This is the application that provides the remote object and responds to method invocations from clients.
RMI can be compared to CORBA (Common Object Request Broker Architecture), which is a platform-independent, language-independent middleware system that allows objects to communicate with each other in a distributed environment. While both RMI and CORBA provide mechanisms for distributed communication and method invocation, there are some differences between them:
- RMI is a Java-specific technology, while CORBA supports multiple programming languages.
- RMI uses Java object serialization to transfer data between client and server, while CORBA uses a standard data representation called the Common Data Representation (CDR).
- RMI is simpler to use and has better integration with Java, while CORBA is more complex but offers more flexibility and interoperability.
- RMI provides tighter integration with Java's security model, while CORBA provides a more general security model.
In general, RMI is a good choice for Java-based distributed applications, while CORBA is a better choice for more complex, heterogeneous environments that involve multiple programming languages and platforms.
No comments:
Post a Comment
If you have any doubts, please let me know