RMI Architecture
RMI system allows
an object running in one JVM to invoke methods on an object in another
JVM. RMI can communicate only between programs written in Java.
RMI applications often consist of two applications:
a
server and
a
client
The application is divided into objects. A server creates remote objects
and registers these objects with a simple bootstrap name server called
a registry (rmiregistry). The client gets a handle by looking
up the remote object by its name in the server(s) registry and invokes
methods on it.
|
Every distributed
system is built on the top of a network, so network is an essential
part of all these systems.
|
Remote
object
A remote object is one whose methods can be invoked from another
JVM practically on a different machine. In situations where you do not
have a network, or a client, or a server available to test programs,
you can invoke methods on a remote object from another JVM on the same
machine. A remote object must implement at least one interface that
extends the java.rmi.Remote interface.
Remote
Interface
A remote interface is an interface, which declares a
set of methods that may be invoked remotely (from a different JVM).
All interactions with the remote object will be performed through this
interface. A remote interface must directly or indirectly extend the
java.rmi.Remote interface. Each method
declaration in a remote interface must include java.rmi.RemoteException
or one of its superclasses in its throws clause.
|