Reputation: 1508
I have developed an RMI application where the RMI server has to be started several times and also has to stop several times.
Upvotes: 1
Views: 2096
Reputation: 310985
You don't really need to send a notification. Clients of an unexported remote object will get a NoSuchObjectEzception next time they do a remote method invocation on it. They just need to recognize the situation.
Upvotes: 0
Reputation: 6656
I'm not sure what you mean with the "RMI server", the RMI registry you cannot stop programmatically. But you can stop your service (bound to the RMI registry). You should invoke a custom method to cleanly shutdown your service and then unbind
it from the registry.
Before this shutdown and unbinding you should inform all connected clients that the service will be shut down. This notification can be done by callback. Searching for RMI callback
will give you a lot of examples and tutorials.
Upvotes: 1