This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Multi-threaded RMI server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Multi-threaded RMI server" Watch "Multi-threaded RMI server" New topic
Author

Multi-threaded RMI server

Mark O' Sullivan
Ranch Hand

Joined: Aug 17, 2009
Posts: 160
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

Joined: Dec 28, 2007
Posts: 2258
    
    3

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.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Mark O' Sullivan
Ranch Hand

Joined: Aug 17, 2009
Posts: 160
Cheers, thanks, what a relief!
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5139
    
  12

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


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Multi-threaded RMI server
 
Similar Threads
Synchronization between Remote and GUI
Connection is failing at ObjectInputStream for Server
question about RMI & Thread
B&S Stub errors running in network client mode
NX: URLy Bird 1.3.1 Connection Factory Design