aspose file tools
The moose likes Distributed Java and the fly likes RMI Fundamentals Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Distributed Java
Reply Bookmark "RMI Fundamentals" Watch "RMI Fundamentals" New topic
Author

RMI Fundamentals

Jason Kingsley
Greenhorn

Joined: Feb 21, 2004
Posts: 18
Hi all,
Is my understanding correct (am looking at moving a C# Remoting project to Java)?
Objects that are exported (ie reachable from another process space) and that usually subclass UnicastRemoteObject listen on their own server socket?
So for example, we have a well named object "Foo" that is bound in the naming registry (say 1099) so that when an RMI client looks it up it can discover Foo fine. Foo, creates a remote object:
public class MyRemote extends UnicastRemoteObject implements MyRemoteInterface
{
public void doThisMethod() throws RemoteException
{
//
// do work...
//
}
}
that it returns to the client, who has the appropriate stubs. Now, that instance of MyRemote is now listening on an arbitrary port for incoming connections like a mini-server, and whats more, is in its own thread.
Any incoming connections themselves will spawn their own thread to service the remote call.
This has ramifications in that this object, on an arbitrary server port is unreachabe if on the inside of a firewall and whats more, any remoted object is consuming resources with threads and server socket.
With this in mind, RMI doesn't particularly scale well or even cater even for groups of remoted objects providing services to a few dozen clients and seems more designed for heres a small number of global objects that facade for some logic.
Cheers
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
I think you've basicaly got it right. I don't know if remote calls to the server methods create new threads.
Jason Kingsley
Greenhorn

Joined: Feb 21, 2004
Posts: 18
Hi there,
Thanks for the reply, I wrote some test code and every new'd remoted object spawned in its own thread with a server socket and blocked waiting on accepts from client connections which would intern be run in their own threads on the accept.
So for n exported objects with m concurrent calls it looks like you get n+m threads.
Cheers
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RMI Fundamentals
 
Similar Threads
Problems running RMI
do i have to supply a port number when start server?
NX: Selecting the port number
Question about the RMI factory pattern
how to get Clients CPU information on Server using Java RMI