Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Shall I handle the client id when lock?

 
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.
 
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
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic