The Naming.unbind Method
-
The Naming.unbind(<url>) method takes 1 argument:
-
the url of an object in a rmiregistry (e.g., "ObjectToBeRemoved").
-
Since objects can only be removed from the local machine, we do
not have to give a full url.
-
Below is a code fragment that removes ObjectToBeRemoved
from the rmiregistry.
try {
Naming.unbind("ObjectToBeRemoved");
} catch (NotBoundException e) {
System.out.println("Object
not in registry");
} catch (RemoteException e) {
System.out.println("Couldn't locate Registry");
} catch (MalformedURLException e) {
System.out.println("Couldn't parse URL string");
} catch (UnkownHostException e) {
System.out.println("Can't locate host. Spelling?
DNS running?");
}