aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Stop RMI Registry from code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Stop RMI Registry from code" Watch "Stop RMI Registry from code" New topic
Author

Stop RMI Registry from code

Liang Anmian
Ranch Hand

Joined: Jun 25, 2004
Posts: 119
I started the RMI registry using the following code:



How do I remove the RMI registry? It's not enough to unbind the remote object. I want to destroy the registry. Is there any way?


Current Status:<br /> <br />SCJP 1.4<br />SCJD (in progress)
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
I don't think there is a way. Neither LocateRegistry nor Registry provide a destroy or unload method of some sort.

Of course the registry will be gone when the JVM it runs in (in the case you started it from code that's the JVM your application runs in) terminates.


42
Liang Anmian
Ranch Hand

Joined: Jun 25, 2004
Posts: 119
Gosh. My server GUI has 2 buttons. One of them is the start RMI service button, while the other is the halt RMI service button. Now I guess I have to think of other workarounds for the halt button.

Thanks for your input.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
you can use registry.unbind(String) to remove a service from the running registry.
Or alternatively define a NullObject implementing the same interface as your real service and rebind to that.
That way the client could still call the service without getting exceptions and the remote dummy service could then give nothing back on every read request and ignore all updates (maybe handing a message that the service is unavailable instead as a statuscode).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stop RMI Registry from code
 
Similar Threads
NX: RMI registry port ConnectException if not on 1099
RMI registry auto start
RMI UnmarshalException
How to run RMI in NetBeans?
Shut down RMI Registry