RMI Notes
A remote object implementation (one that implements one or more remote interfaces) must be created and exported. Exporting a remote object makes that object available to accept incoming calls from clients. For a remote object implementation that is exported as a UnicastRemoteObject, the exporting involves listening on a TCP port (note that more than one remote object can accept incoming calls on the same port, so listening on a new port is not always necessary). A remote object implemention can extend the class UnicastRemoteObject to make use of its constructors that export the object, or it can extend some other class (or none at all) and export the object via UnicastRemoteObject's exportObject methods. The object must be exported prior to the first time it is passed in an RMI call as either a parameter or return value, otherwise, a java.rmi.server.StubNotFoundException is thrown when a remote call is attempted in which an "unexported" remote object is passed as an argument or return value.
Once exported, the object can be passed as an argument in an RMI call or returned as the result of an RMI call.
The exportObject method returns a Remote stub which is the stub object for the remote object, obj, that is passed in place of the remote object in an RMI call.