I have a user interface, that takes port no and dbfile file name . I have buttons to start and stop server. Starting and stoping once is fine, but if i try to restart after stopping, i get message objId is already in use. To stop my server , user interface exits the JVM, and this stops the server. I feel , this is not nice way. I should be able to stop the server, while GUI is displayed and restart it again. code to start and stop server.
Hi Akash, Your problem is because you cannot stop the Sun RMI Registry programattically. You can stop (or unbind) your server process from the registry, and then bind a new server process to the registry. You could even start a new registry on a new port (while still leaving the old registry running on the old port). I would suggest that you either
catch the exception that tells you that the registry is already started, and log the message then try and continue with the bind process, or
don't allow the user to change the port after they have started the registry first time
Hello, to start and stop the server I use the following approach.
And now I'm surprised: When I call stopServer(), the server stops to serve connections to new clients or clients, which want to reconnect. Ok, that's what I've expected. But clients, which got their connection before, are still working fine. (Until they try to reconnect). How can I achieve the connection created in startServer() stops to do its work? And why does it work at all? Thanks for all suggestions Werner [ November 14, 2003: Message edited by: Werner Joerling ]