RMI Registry and Naming

I am new to RMI;What is the difference between the Registry and naming services for lookup?

I see examples that do:

Registry registry = LocateRegistry.getRegistry(RemoteInterface.REGISTRY_PORT);

RemoteInterface remoteReference =

(RemoteInterface) UnicastRemoteObject.exportObject(new Server());

registry.rebind(RemoteInterface.REGISTRY_NAME, remoteReference);

as well as examples that do :

AccountImpl acct = new AccountImpl("JimF");

// Register it with the local naming registry

Naming.rebind("JimF", acct);

So what's the difference in binding to registry and naming service.I understand that both of them refer to the Registry in any case.

[710 byte] By [rana30a] at [2007-11-26 13:35:25]
# 1

> I understand that both of them refer

> to the Registry in any case.

Just a different API.

This is the implementation of Naming.bind()

public static void bind(String name, Remote obj)

throws AlreadyBoundException,

java.net.MalformedURLException,

RemoteException

{

ParsedNamingURL parsed = parseURL(name);

Registry registry = getRegistry(parsed);

if (obj == null)

throw new NullPointerException("cannot bind to null");

registry.bind(parsed.name, obj);

}

genadya at 2007-7-7 22:18:35 > top of Java-index,Core,Core APIs...