This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Shall I handle the client id when lock? 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 "Shall I handle the client id when lock?" Watch "Shall I handle the client id when lock?" New topic
Author

Shall I handle the client id when lock?

Jane Wang
Greenhorn

Joined: Mar 07, 2002
Posts: 16
I use the RMI to implement the remote connection. And I lock the db record in db level. I just use a Vector to record which record is been locked, if it is locked, then wait for the release.
I read some of the topics and find some people handle the client id when lock. For my understanding, the database should know which record is locked but do not care who locks it. Since all client follows lock->read->modify->unlock senario, no other client can do the job from read if it doesn't have the key.
friso dejonge
Ranch Hand

Joined: Jul 11, 2002
Posts: 162
I use the RMI to implement the remote connection. And I lock the db record in db level. I just use a Vector to record which record is been locked, if it is locked, then wait for the release.
I read some of the topics and find some people handle the client id when lock. For my understanding, the database should know which record is locked but do not care who locks it. Since all client follows lock->read->modify->unlock senario, no other client can do the job from read if it doesn't have the key.

1. dont use a vector, but use something from the new collections group, like arraylist.
2. The actual requirments say

The unlock method simply removes the lock from the specified record. If an attempt is made to unlock a record that has not been locked by this connection, then no action is be taken.
This means that you have to know who (which client) locked the record. On how to do this, there is a very large discussion on this topic (+50 replies) which will help you on the way
regards,
friso


swimming certificate (A & B), shoelaces diploma, and some useless java ones.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Shall I handle the client id when lock?
 
Similar Threads
record lock&unlock
Deadlock during record locking
Locking Suggestions and Help
Networking : RMI
B&S 2.1.1: lock(), delete() and unlock() confusion