Forums Register Login

RMI Question another one ?

+Pie Number of slices to send: Send
Aaaaaaarrghhhhhh
I'm trying to unbind my connection factory, so I can stop client accessing the Server while I re-cache the Database. Though I'm having problems, I receive the ExportError Exception: ObjID Already in use when I try to create the registry for the second time.
My code is as Follows

So is there anyway of un-creating the registry once it's created, without quiting the application ? Or have people just quit the application if they want rid of the RMI connection, which to me seems a bit rubbish.
Any help would be appreciated ?
Tony
+Pie Number of slices to send: Send
Looking through the Sun developers forum the only way to stop the RMI registry is to exit the main thread. Why I don't know ?
So restarting the Server progrmatically seems to be a little difficult and I would think not worth the hassle.
I wonder if all entrys in the registry are deleted when it is stoped via exit.
Tony
+Pie Number of slices to send: Send
Hi Tony,
In your case, I think all you need to do is unbind() your remote object from the registry. You can leave the registry running while you re-cache the database. Any client that then tries to get a reference to your remote object will fail. This should meet your requirements.
Alternatively: don't try to code for this at all . After all, there is no requirement to re-cache the database.
It has also been mentioned quite a few times in this forum that it does not appear to be programattically possible to shut down the registry.
I would guess that this is because of complexity / security reasons. You would presumably need the registry to listen on some other "administration" port for commands such as shutting down the registry. You would probably want to password protect it (so it cannot be shut down by a malicious user). You would probably want some command to just disable new registrations first, before removing existing registrations. You would probably want to have some way of notifying existing clients that their registrations is being removed. And so on.
I think the only thing you can do is just exit() your main application which will shut down the registry.
If you wanted to be nice you could check if anyone else has registered with your registry first, and display a warning message if that does happen. (But since most people don't set up the security necessary for other applications to register with their registry, I guess this can't happen anyway, so you might also wan't to skip it).
Regards, Andrew
And then we all jump out and yell "surprise! we got you this tiny ad!"
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 872 times.
Similar Threads
RMI pass by value or by reference ?
NX: concerning exception handling
NX:exceptions while the registering and binding -process
Java RMI Client AccessControlException
NX: RMI and thread safe
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 05:50:31.