Hi all, I have a question. Is multithreading build into RMI already? Do I need to cater for this specifically on my RMI server? I asked this because once I get my RMI server running, I don't seem to get any output to the console when clients connect like printing "there are x clients connected". Thanks
K. Tsang wrote:Hi all, I have a question. Is multithreading build into RMI already? Do I need to cater for this specifically on my RMI server? I asked this because once I get my RMI server running, I don't seem to get any output to the console when clients connect like printing "there are x clients connected". Thanks
Hi,
I'm not sure I understand entirely your question.. Let me try to go trough a sequential scenario:
- You start your RMI Registry;
- You start your server;
- You bind an Object from your server into the Registry (this will be the Remote object);
- You start several clients;
- Several clients can get a reference to your remote object from the RMI Registry;
- Multiple threads will be started/used by the RMI runtime upon concurrent call of a method on the remote object;
- It is up to RMI to reuse a Thread or create a new one when a request is made (and ultimately destroy it).
Hi Alex....Let me asked somenthing about RMI....there will we only one instance object bind inside RMI control and many remote proxy references ? .....like servlet inside servlet container ?
thanks Alex, from your description and the look of things, RMI is multithreaded already.
The thing I hope to do for my RMI server is to display messages as clients connect.
Alex Belisle Turcot
Ranch Hand
Joined: Apr 26, 2005
Posts: 516
posted
0
K. Tsang wrote:thanks Alex, from your description and the look of things, RMI is multithreaded already.
The thing I hope to do for my RMI server is to display messages as clients connect.
I'm not sure if your server can tell if a client gets a reference to your object..
I guess you should add a method on your remote class and have each client calling it..
something like:
Regards,
Alex
Alex Belisle Turcot
Ranch Hand
Joined: Apr 26, 2005
Posts: 516
posted
0
Fernando Franzini wrote:Hi Alex....Let me asked somenthing about RMI....there will we only one instance object bind inside RMI control and many remote proxy references ? .....like servlet inside servlet container ?
That's exactly my understanding, the server instantiate an object and makes it available through the RMI Registry. Sor sure, any client requesting a reference will get the same one.
I know what you mean with the servlet example, but in my opinion the concept is not the same. With Servlet, the clients don't really hold a reference to it and there *could* be different servlet handling requests from different clients based on the webapp configuration.. Anyway, I don't want to argue on semantic, I think you get it..
A similar concept (as RMI) would be EJB Stateful Session bean..