File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes rmi server and deadlock 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 "rmi server and deadlock" Watch "rmi server and deadlock" New topic
Author

rmi server and deadlock

James Du
Ranch Hand

Joined: Mar 23, 2001
Posts: 186
Hi all,
I'm wondering how rmi server arrange the client calls in the case there's only one remote object to service all the clients. under some circumstances i think it's somewhat awkward.
Here is my understanding:
Since there's only one remote object, there's only one thread(rmi server does not spawn a new thread for each client's look up method, it just simply pass the reference. is it right?) for all the clients connection.
When the clients make concurrent invocations, how the server arrange that? I think since no priority issues here, the server just service the first call and make the call atomic(another guesswork, if i'm wrong pls correct me), the server does not guarantee that 2 calls contained in 1 client method could not be
interrupted by other clients' call. During one call, all other calls must wait in queque for it (the present invocation) to finish.
What if the present call is a blockable method? and what if when the cause of the block is that the present call is requiring the resource occupied by some waiting client? the present client hold the thread and require the resource held by other client but cant get the server thread to release it, isn't it a deadlock?
let's take FBN project for example and suppose there's a method bookSeat() at the client
public void bookSeat(int i) throws RemoteException
{
data.lock(i);
...
data.unlock(i);
}
suppose client_1 locked the record_n and losed the server thread control, at the time, client_2 get the thread and wish to lock the record_n, deadlock formed.
My solution for this is to put such method in the Remote object, let server guarantee the bookSeat() method be a atomic method. Is my solution feasible?
All my reasoning is largely based on my guesswork, i wish some guru could clear it up and give me a verification.
And could someone give some good website and articles concerning this?
Thanks in advance
- James
[ March 11, 2002: Message edited by: James Du ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: rmi server and deadlock
 
Similar Threads
lock and unlock
Defence using current thread as client's ID
Record locking on recNo
lock/delete/unlock as atomic operation
NX:Client crashed cause deadlock in LockManager