• 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

Create 2 registry under different port?

 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm having a problem to create a Registry under 2 different port.
I'm trying to allow user to configure the server to bind to different port at runtime.
Thus, if he starts up in port 1099, he can use the GUI to switch to e.g. 1090.
However, if I use
LocateRegistry.createRegistry(portNumber);
The second time when it is call, it says "ObjID already in use".
But if I continue to rebind my Server object to the registry. It says NoSuchObjectException.
Can anyone advice how do I create a Registry that listen to another port when a Registry is already created.
And, is it possible to know if a Registry is already running on a specified port.
Thanks for any advice.
Cheers.

Han Ming
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I couldn't find any method that would close the registry. Of course if you have

Registry reg = LocateRegistry.createRegistry(1099);
and then set reg to null, it might close it. But I don't have first hand knowledge that it will.
However, I would ask why you need to give the User the ability to change the port number once the server has already been started.
You can have the user put the port number in the command line as stated in the specs as allowed

These command lines may only take configuration parameters selected from this list:
DNS name of the server
Port number used by the server


Mark
 
HanMing Low
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mark,
Thanks for the advice.
I think you're right that there doesn't seem to be any method to drop the registry.
I guess I have to drop the feature in this case.
The reason I'm including the feature is not for the client but server rather.
I'm having a Server GUI that allow configuration to be made on the Server.
e.g.
which db.db file it connect to
which port number
etc.
Thus, to allow the server to switch to a different port using the GUI, I need to unbind the object from registry, start a new registry at the new port and rebind the object at this new port.
But looks like there is a problem with the registry as executing
LocateRegistry.createRegistry(1099);
LocateRegistry.createRegistry(1090);
will cause an ObjID already in use for the 2nd statement.
Should it be like this?
I'm not sure actually, but I'd expect it to create a registry that bind to port 1099 and another to port 1090.
So, I guess it's a better idea to drop the feature.
Thanks again for your advice.
Cheers.
Han Ming
 
It will give me the powers of the gods. Not bad for a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic