permaculture playing cards*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Record Loking (UrlyBird) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Record Loking (UrlyBird)" Watch "Record Loking (UrlyBird)" New topic
Author

Record Loking (UrlyBird)

Mike Tilling
Ranch Hand

Joined: Feb 17, 2006
Posts: 86
Could you help please

I've used RMI as network mode

the locks methods are called within the methods implemented within the Data class (create, remove and book).

The method that books a record starts by bookLock() and end up with bookUnlock() and all the methods run on the server side, so if the same client tries to book the same record twice at the same time, on the server side there will be two different threads that will call {bookLock(), update(recNo) and bookUnlock}, and the record locking solution will be valid and the server does not need to know if the same client is trying to lock the record for the second time without releasing the record lock.

Please Advice
Mike
Kevin Conaway
Ranch Hand

Joined: Jan 27, 2006
Posts: 57
Mike,

Perhaps you should associate some kind of unique identifier with each client? This the clients can be identified independent of the whatever thread they might use.

Kevin
Mike Tilling
Ranch Hand

Joined: Feb 17, 2006
Posts: 86
Originally posted by Kevin Conaway:
Mike,

Perhaps you should associate some kind of unique identifier with each client? This the clients can be identified independent of the whatever thread they might use.

Kevin
Mike Tilling
Ranch Hand

Joined: Feb 17, 2006
Posts: 86
Thanks Kevin,

What I wanted to say is,

There is one RMI Server Object,
The client can invoke one of the following methods on the RMI Object

1-book (data) which books the selected record
2-remove (data) that deletes the specified record from the database file
3-create(data) which adds the specified record in the database file

each of these methods run on the server side, and (on the server side) they start by locking the record and end up with unlocking the record.

When the client invokes the create(data) method (for example), I wanted to confirm if there will be two different threads running on the server side.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Record Loking (UrlyBird)
 
Similar Threads
Urly Bird
Confused- Urgent!!!
lock/unlock & synchronized
My Locking Strategy...
Adapter or not Adapter ???