• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

RMI multithreading

 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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).

Does this helps ?

Alex
 
Ranch Hand
Posts: 489
2
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
K. Tsang
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 516
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 516
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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..

Regards,
Alex
 
Fernando Franzini
Ranch Hand
Posts: 489
2
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes Alex...I agree with you...Like stateful EJB !!.
see yah.
 
It's just like a fortune cookie, but instead of a cookie, it's pie. And we'll call it ... tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic