Search code examples
javarmi

UnicastRemoteObject.exportObject(this, 0);


I do not quite understand what

UnicastRemoteObject.exportObject(this, 0);

is for. Is it to register an object on rmi server or what. Hope someone can shine me some light.


Solution

  • From Getting Started Using Java RMI

    The static method UnicastRemoteObject.exportObject exports the supplied remote object to receive incoming remote method invocations on an anonymous TCP port and returns the stub for the remote object to pass to clients. As a result of the exportObject call, the runtime may begin to listen on a new server socket or may use a shared server socket to accept incoming remote calls for the remote object.