Forums Register Login

Notify after unlock

+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
thanks by the way...
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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!
I'm still in control here. LOOK at this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 577 times.
Similar Threads
How to simulate multiple clients for testing
Elegant solution to waiting without CPU activity?
Do I need notify()/wait() etc. when I just mark all Data-methods synchronized?
Unique Id for lock/unlock
Orphan LOCKS/Lost Clients
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 02:54:39.