This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma 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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Multi-threaded RMI server" Watch "Multi-threaded RMI server" New topic

Multi-threaded RMI server

Mark O' Sullivan
Ranch Hand

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

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.
(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)
Roberto Perillo

Joined: Dec 28, 2007
Posts: 2271

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

Joined: Jul 19, 2004
Posts: 8411

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,

SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
I agree. Here's the link:
subject: Multi-threaded RMI server
It's not a secret anymore!