I surfed the net on this. Couldn't find any appropriate tutorials.
Please explain this:
How to use RemoteObject.toStub(Remote rmo) for dynamically creating stub of remote object? How these stub objects are interpreted at client end and save the task of running rmic utility.
How to use
RemoteObject.toStub(Remote rmo)
for dynamically creating stub of remote object?
You don't. That only returns an existing stub. The stub is created when you export the object. The stub is dynamic under the conditions specified in the Javadoc preamble for UnicastRemoteObject
.
How these stub objects are interpreted at client end and save the task of running rmic utility.
They are created by java.lang.reflect.Proxy
, implementing the same Remote
-extending interfaces as the remote object, and with an InvocationHandler
that does all the remoting for you. The client just sees it as an implementation of the remote interface(s).