What happens if a thread tries to invoke UnicastRemoteObject.exportObject(server), if the server is already exported.
Why are you trying to export the server? You don't need to, as it is done automatically when the object that extends Remote(your server) is instantiated. But that doesn't matter at all. It should be under your threshold of concern if you are just using standard RMI, as it is all done for you.
Does it throw an exception ?
I don't know, the docs only say that it throws an error if the export fails, but it doesn't state whether a duplication would constitute a failure. Try it. Run this command twice in a row in your code. I doubt it will throw an error.
Basically I didn't get the concept of exporting a server correctly. Does it mean that unless a RMI server is exported, we can't invoke methods on it ?
Don't worry about doing it directly like this. This is only used internally AFAIK. Use the registry to access it. You can't invoke methods on a server if it isn't exported, but it is done for you as I mentioned above, and you just have to bind it to the registry.
If you really want to know some of the guts of RMI, read about halfway down in
this post. If you're just getting started with RMI, ignore that. It will probably just confuse you. Or not, depends on how much you like to know about how things work.
HTH, any other questions?
Chris
[ May 11, 2004: Message edited by: Chris Shepherd ]