In Remote Method Invocation (RMI) technology, Stub and Skeleton are two important components that facilitate communication between remote objects.
The Stub and Skeleton work together to provide a transparent mechanism for remote method invocation. The client-side Stub hides the details of the network communication and marshalling of method arguments, while the server-side Skeleton hides the details of the method dispatching and unmarshalling of method arguments.
RMI Architecture:
The RMI architecture consists of four main components: the Remote Interface, the Remote Object, the RMI Registry, and the Client.
- Remote Interface: A Java interface that defines the methods that can be invoked remotely by clients. The Remote Interface extends the java.rmi.Remote interface and each method must throw a java.rmi.RemoteException to indicate that it can generate a remote exception.
- Remote Object: A Java object that implements the Remote Interface and provides the implementation for the remote methods. The Remote Object extends the java.rmi.server.UnicastRemoteObject class to export its methods for remote invocation.
- RMI Registry: A registry that allows clients to look up remote objects by name. The RMI Registry is implemented as a server that listens for incoming requests from clients.
- Client: A Java application that invokes remote methods on remote objects. The Client uses the RMI Registry to obtain a reference to a remote object and then invokes its methods as if they were local methods.
No comments:
Post a Comment
If you have any doubts, please let me know