Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: URLyBird 1.3.3 -- How to remove the rmi regristed port number ?

 
kwwong wong
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am developing GUI for database server currently. I want that my GUI has Start button and stop button on it. So that when user click the start button, it will registy the port as follow :
java.rmi.registry.LocateRegistry.createRegistry(Integer.parseInt(portNum.getText()));
//make a database instance
db = new DatabaseImpl(databaseName);
//register
Naming.rebind("DBMediator", db);
When the user click the stop button, how to delete the rmi regristry port number ?
If I only unbind the service,
//make a database instance
db = null;
//register
Naming.unbind("DBMediator");
when I click the start button again, it give me the follow error.
C:\kwwong>java suncertify.remote.ServerRunner
Jul 23, 2003 6:42:41 PM suncertify.remote.ServerWindow$3 actionPerformed
SEVERE: java.rmi.server.ExportException: internal error: ObjID already in use
 
Ta Ri Ki Sun
Ranch Hand
Posts: 442
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont have a GUI for my database server, but that error looks familiar, if my server doesn't start for certain reasons then I attempt to re-start automatically, eg the database could not be found, I ask the user if he/she wants to re-configure and if yes then I'll present the config screen, they re-configure and I retry, anyhat, closer to your topic, what I had to do was hold a boolean indicating whether or not the registry was created, and if yes then I getRegistry, else createRegistry
 
kwwong wong
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems that it is no clear way to stop the server except exit the application. So that my GUI in server has only two button, one is Start, another is Quit. It also provide the user to change the location of the data file.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My suggestion is to have one button.
When you run your server, it automatically starts your server, so you won't need a Start Button.
The button on the form is just a Shutdown or Stop button.
When the server Admin clicks this button it shutsdown the server.
If they want to start it again they have to run your server again. This way you won't get the error.
Mark
 
kwwong wong
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My server GUI has a text field for setting the location of the data file and the text field for setting the port number. So when user start the application, the screen is shown with the default(or previous setup) database location and port number. The user can set this attribute before start the server. Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic