Remote Method Invocation (RMI) : It allows an object running in one Java virtual machine (say a client machine) to invoke methods on an object running in another Java virtual machine (a Server machine).
- Server accepts tasks from clients, runs the tasks, and returns any results. The server code consists of an interface and a class. The interface defines the methods that can be invoked from the client.
- RMI interface extends the interface java.rmi.Remote, and each method declares java.rmi.RemoteException in its throws clause.
- Server register its remote objects with RMI's simple naming facility, the RMI registry.
- Client program obtains a stub for the registry on the server's host, looks up the remote object's stub by name in the registry, and then invokes method on the remote object using the stub.
- A Serializable object can be passed to-and-fro Client-Server.
- Source files can be compiled like : javac -d destDir RMIInterface.java RMIInterfaceImpl.java Client.java