aspose file tools*
The moose likes Distributed Java and the fly likes RMI Registry Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "RMI Registry" Watch "RMI Registry" New topic
Author

RMI Registry

birmingham city
Greenhorn

Joined: Nov 30, 2002
Posts: 2
Please could you explain this to me in basic english.thanks
public static Registry getRegistry(int port) throws RemoteException
{
Registry registry = null;
try {
registry = LocateRegistry.getRegistry(port);
registry.list();
}
catch (Exception e) {
System.out.print("Registry not found on port " + port);
System.out.println(" - creating one...");
registry = LocateRegistry.createRegistry(port);
}
return registry;
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

"Birmingham city" -
Please take a moment to review JavaRanch's naming policy, and change your name accordingly; thank you.
The code above locates an RMI registry on the local system. The list() call normally returns a String[] of named services already bound to the registry. In this example the return value is ignored, so perhaps it's invoked to provoke a possible exception.
The catch code sets up a registry if one is not found by the code in the try block. This runs a registry without establishing having to do it from the command line. This approach has become particularly popular with people who a) are testing RMI code and want to keep things manageable from one place; and b) people who want a compromise between the cumbersomeness of 'regular' RMI and the administrative control necessary to run an RMI activation daemon.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RMI Registry