Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Shall I handle the client id when lock?

 
Jane Wang
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic