Skip to main content

Posts

Showing posts with the label RMI

What is RMI? how does distributed application created using RMI? Explain with an example.

 RMI (Remote Method Invocation) is a Java API that enables distributed applications to communicate and interact with each other over a network. It allows Java objects to invoke methods on objects running on remote machines, just as if they were invoking methods on local objects. In RMI, a client sends a request to a remote object, which then processes the request and sends a response back to the client. The communication between the client and the remote object is transparent to the developer, as the RMI system handles all the necessary details. To create a distributed application using RMI, we need to follow these steps: 1. Define the remote interface: The remote interface is a Java interface that declares the methods that can be invoked remotely by clients. These methods should throw RemoteException, which is a checked exception indicating that a remote error has occurred. The remote interface should extend the java.rmi.Remote interface. 2. Implement the remote interface: The imp...