What is the difference between the Registry class and Naming class.
In my application I am using Registry class. But I want to know about Naming class and its uses ?
What is the difference between the Registry class and Naming class.
In my application I am using Registry class. But I want to know about Naming class and its uses ?
Copyright © 2021 Jogjafile Inc.
The difference is that
Namingis a utility class with static methods, whileRegistryis a remote interface. Unsurprisingly,NamingcallsRegistryinternally. Note that thenamearguments you pass tojava.rmi.Namingare in URL format, and include the location of the registry, whereas withjava.rmi.registry.Registry, thenameis just the name.For example, you would call something like this:
whereas with
Registry, you need an existing handle on the registry object, and you'd call:So
Namingis really just a convenience class that saves you having to look up theRegistrymanually - it performs the registry lookup and rebind in one step.