• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Notify after unlock

 
luis veron
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
This is my first post here. It's great to have this king of interaction...At the moment, I'm trying to implement (FBN) something like an object that will store (record #) all those record that are currently lock. I was just wondering if for example, record 5 was unlock, then I need to call notifyAll. Will it be possible only to "wake up" all those thread waiting to have a lock in record 5?
 
luis veron
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks by the way...
 
Keith Wheeles
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Luis:
I spent a LOT of time on this and ended up scrapping the idea. I put the recNum of each locked record in a Hashtable. Integer(recNum) was the key, the value was an object to synchronize on. This would work OK if not for the database level lock (recNum == -1).
I found I needed to notify on the following three conditions -
1.) record unlocked (pulling the object out of Hashtable).
2.) database unlocked (with a special object for that).
3.) record lock Hashtable becomes empty (in case waiting for database level lock).
I built a multi-threaded testbed to run against this approach (synchronizing against record specific objects) and found that the lower level synchronizing could result in error ocnditions.
I ended up synchronizing the lock and unlock methods and using instance variables (objects) within the Data class - the objects are much like what I'm describing above.
Unless I relaxed some of my working assumptions (i.e., that a database level lock request would block on both existing database level lock AND on non-empty list of locked records) I was unable to get this work. The code was also a bit convoluted and unappealing.
Thanks,
Keith
 
luis veron
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Keith...
I'm also having a problem thinking on how to implement this kind of solution...Anybody who have solution better idea?
Many Thanks!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic