The RMI Registry is a naming service.
RMI server programs use this service to bind the remote java object with the names.
Clients executing on local or remote machines retrieve the remote objects by their name registered with the RMI registry and then execute methods on the objects.
RMI creates a remote proxy for that object and sent it to clients.
An object proxy contains the reference to an object.
In order to work with the RMI registry…
1. Start registry by using following command
By default the port 1099 is used by RMI registry to look up the remote objects. After the RMI registry starts objects can bind to it.
2. Now in second step to bind the remote object with the RMI registry, execute the server program.
3. To use the remote object execute the client program.
From the figure we can see that server calls the RMI registry to map a name with a remote object represented by black circle.
By using the name of remote objects in the server’s registry client program locate the remote object and then methods are called on the remote object by the client program.