Lara:
Below is some material to give you a better understand of what the deal is with export/rmiregistry/bind. If you need me to go over some of these in greater detail, let me know (I'll admit I'm a little short on time right now...):
1. This article explores how the internals of RMI itself work:
http://www.developer.com/java/other/article.php/10936_3455311_3. This one actually does a very good job, but it is not the one I was originally thiking about. However, I can't seem to find the article now in my mess of magazines...read it carefully, though; can you guess what UnicastRemoteObjects's export method does?
2. Take a look at the Javadoc for UnicastRemoteObject. Notice the parallels between the constructors that are called implicitly by implementors and the export methods? In case you don't take a look at the
Java rmi tutorial here:
http://java.sun.com/j2se/1.3/docs/guide/rmi/getstart.doc.html. Note the sections on "Define the constructor for the remote object".
However, I came across something very interesting while digging around...RMI actually
does support multiple remote objects on the same port (this must be an offshoot of getting rid of explicit skeletons post J2SE 1.3). I verified this by explicitly invoking the constructor with port specification for my UnicastRemoteObjects. Note, however, I'm still not sure if this is default RMI behavior, that is what "anonymous port" really means (I'll
test that next as soon as I get home).
Now I'm curious how this is actually accomplished and what the performance impacts are. I bet the answer lies in the TCP packets of the RMI request itself (probably in the form of additional info identifying a unique remote object to invoke). I'll keep you posted if you are interested...as a matter of fact, let me know if you get to it before me...
I'll be busy for the rest of the day, so hopefully you won't need further help or someone else will be willing to help you out...
Reza
[ June 10, 2005: Message edited by: Reza Rahman ]