Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

stopping rmiregistry  RSS feed

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have what should be a simple question for some of you to answer. How can one stop the rmiregistry? I've searched for the answer to this question, and cannot seem to come up with any guidance.
The problem I am coming across is the following: After making changes to the implementation of the interface which extends java.rmi.server.UnicastRemoteObject, I want to be able to stop the rmiregistry, stop the server, recompile the code, and then restart the rmiregistry and server using the same port. What I have been doing is rebooting my PC each time I make changes, which is obviously time-consuming.
I'm using Windows NT 4.0, but I'm thinking that the procedure to stop the rmiregistry should be similar on different platforms.
 
Peter Reinhardt
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you start the rmiregistry as an external process (rmiregistry.exe) you just have to kill (ctrl-C) the opened MS-Dos console.
If you start the rmiregistry from inside your java code, just stop the VM and restart.
There is certainly no need for rebooting the PC.
Peter.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your response. From your reply, it seems I need to reword my question.
Actually, cntl-C doesn't stop the rmiregistry. I've used this command to get back to the MSDOS prompt, but the rmiregistry thread continues.
I'd like to be able to stop the rmiregistry, and restart it using the same port. Using cntl-C does not stop the rmiregistry's use of the chosen port.
Is it possible to do this from the MSDOS prompt?
How is the rmiregistry started/stopped from within the java code?
 
raimondas zemaitis
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should describe your problem in more details to get exact answer. It is not clear why you need to restart registry each time, is it running as a NT service so that ctrl+c doesn't work or you start it as a process from within Java code.
 
Peter Reinhardt
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you start your rmiregistry by typing rmiregistry.exe in the console you can just kill it by ctrl-c. I have done this since years and never faced a problem. If you get an exception that the port is in use something else might be running on this port (try netstat).
You can use:
rmiregistry.exe <port>
as well and specify a different port (though I don't think this is necessary).
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just want to let you know I figured out the problem...a simple one at that.
It turns out that, contrary to what I've read and been told, an explicit socket.close() is necessary to unbind a socket from a port to free the port for a new socket connection.
 
abhi zulu
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am too intested in knowing a cleaner way
(other than ctrl-c ) Someone suggested restarting the JVM How can we restart the JVM using code ??
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!