Lifecycle of the server
Dear community,
if I register my remote object to the registry and do notthing further more and the server-thread is active. Now I want to control the server. I could register an administration interface and make it remote available. No my questions:
1. How can I stop the server or restart it?
2. How can I see, which clients are connected (do I have to implement my own mechanism?, eg.g storing all clients in an array?)
A I have a further questions to a remote method itself: In the remote method on the server I can create new objects for processing the request. These objects are exclusivly bounded to the remote request of one client? - For each new remote access of a new client the objects are generated again?
Thank you for your answers.
Dak
[793 byte] By [
dakgera] at [2007-11-27 4:51:43]

# 1
> 1. How can I stop the server or restart it?
Have it call UnicastRemoteObject.unexportObject() and probably Naming.unbind() to stop, and UnicastRemoteObject.exportObject() and probably Naming.bind() to restart.
> 2. How can I see, which clients are connected (do I
> have to implement my own mechanism?, eg.g storing all
> clients in an array?)
Yes.
> A I have a further questions to a remote method
> itself: In the remote method on the server I can
> create new objects for processing the request.
Yes. Have your remote method return 'new MyNewObjectImpl', whatever that may be. That way only that client has a reference to that new object. When the client has finished with the object it can either just discard the remote reference and let DGC collect the remote object after 10 minutes, or call some method on the object which causes it to unexport itself.
ejpa at 2007-7-12 10:05:30 >
