• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

stopping rmiregistry

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ??
 
what if we put solar panels on top of the semi truck trailer? That could power this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic