• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

RMI Registry

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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;
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic