• Post Reply Bookmark Topic Watch Topic
  • New Topic

Best practices with starting registry

 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just out of curiousity, in the "real world", would you actually use LocateRegistry.createRegistry() to start a registry, or is it more prevalent to use the command line rmiregistry <port>?
Also, would your server classes actually bind themselves, or would you have a separate class that instantiates and binds the remote objects for you (I'm thinking the latter).
Thanks!
[ April 09, 2002: Message edited by: jason adam ]
 
Andras Nemeth
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
From my personal experience starting registry separately could just cause problem... Forgot to start it...
I prefer createRegistry from my server, of course it can be parameterized... Port number must be able to given at start. It also gives you the opportunity to not start the RMI server if the registry can not be started.
Of course there could be other issues, which might makes you use the command line registry. E.g: you want to register a bunch of server... Although, it could be handle programatically, too, you should always consider the simplest way...
Cheers,
Ban
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's where I'm at right now, trying to weigh the goods and the bads of both. Programmatically, I don't have to worry about opening a new dos window and can have one class go through and set everything up, and I'm done.
But according to one of my instructor's, he says you hardly ever see createRegistry() being used, and that the registry is almost always started from a command line. For some reason, I can't see the extra benefit of doing the command line, it seems to me that you would be able to control more within a program.
Thanks for the input Andras!
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I find this area more a question of mindset than best practice.
Speaking from a programmerly perspective, I might like createRegistry() because it keeps me and my program in control of the environment needed for a successful run. However, while successful execution is important, it can be dangerous to insist on system control as a means to achieve it.
Bear in mind the RMI registry isn't part of any one program; it's a system service that advertises the availability of all remote objects on one machine. It's limited to one machine only because there's a risk in providing lookup services for objects from untrusted systems. Also, thinking of the registry only in terms of the server application doesn't take into consideration what happens if a client calls on the service 'too early.'
Firing up the registry from one subscribing application is a lot like letting your browser fire up DNS each time it runs. There's an inherent assumption that one user (or process) is running the whole machine.
Even if it seems more cumbersome or 'less reliable,' it is a more general (and therefore 'better') approach in a server/multiuser environment to run rmiregistry without regard for the remote services that might use it.
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Michael, didn't think about that!
That makes a lot of sense, and I'm sure that you could easily make your rmiregistry fire up when the server comes up, to run as a service. That way, like you said, you aren't relying up a single program you have to run first before your registry is up. Very good point, one I think that takes precedence over the programmatic standpoint. That pretty much answered it for me.
Thanks for the input y'all!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!