Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

lock / unlock with no client trace

 
Raffe Paffe
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it ok to implmenet lock and unlock in Data using no "tracing" of the client? You trust that the client making the lock is the same as the one making unlock?
You just save the recordnumber in a Vector since it is synchronized.
It is simple and it should be enought.
Any comments?
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No it isn't. Read supplied javadoc for unlock(). Vector is a very, very bad idea -- the very fact that it's synchronized will just tempt you into writing thread-unsafe code. Use the Collections classes (ArrayList, LinkedList, HashSet, HashMap...)
- Peter
 
Raffe Paffe
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, my bad. Thanks, but is the other ok? This is the simplest way. Any comment would be great.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic