This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multi-threaded RMI server

 
Mark O' Sullivan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Just wondering which of the following is correct for a multi-threaded server in RMI or neither.
I could call the RMI connection in package remote from client GUI like this and assumed server started.

(a)
Now does it automatically create a multi-threaded server. using following in the GuestConnector class in remote package.

or does it require the creation of a thread each time this GuestConnector class is called in order to run.
(b)
(1) ensure class implements Runnable interface.

Does RMI automatically create new threads for user or does one have to create multi-threaded server as in b.
Please note I am also sharing the one object amongst threads. (hopefully)
Thanks.
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, Mark!

Champion, no need to worry. RMI automatically creates a new Thread for each request. Your job will be to make sure that your server handles these Threads/requests properly, which is where your locking mechanism fits in.
 
Mark O' Sullivan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cheers, thanks, what a relief!
 
Roel De Nijs
Sheriff
Posts: 9838
103
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,

Maybe the RMI tutorial from Sun is useful for you. It shows you how simple it is to setup a rmi-server. And like Roberto said: your task (a not so easy one) is to handle the multiple requests properly.

Kind regards,
Roel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic