aspose file tools*
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
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: 2265
    
    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: 5266
    
  13

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/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multi-threaded RMI server