We’ve done three things with the RMI registry: we’ve launched the actual registry server, we’ve bound objects into the registry using strings for names, and we’ve looked up objects in the registry.
All of the
code we’ve written has used static methods on the
class to accomplish these tasks. In particular,
the following five static methods:
public static void bind(String name, Remote obj) public static void rebind(String name, Remote obj) public static void unbind(String name) public static String list(String name) public static Remote lookup(String name)
naturally divide into two sets: those called by
the launch code and those called by clients. The
unbind( ), and
rebind( ), deal with the mechanics of
inserting and removing servers from a registry.
The client methods,
), deal with querying a registry to find
three methods deal with binding or unbinding a
server into the registry. Each of them takes a
string argument called
name. In addition,
bind( ) and
rebind( ) take an
instance of a class that implements the
Remote interface. The
first thing that any of them do is parse
name to find out where
the registry is running.
name is a combination of the location
of the RMI registry and the logical name of the
server. That is, it is a URL with the following
host and ...