CDV ❯ Enhancement to ReentrantLock.tryLock(long timeout, TimeUnit unit) API
-
New Feature
-
Status: Closed
-
2 Major
-
Resolution: Fixed
-
-
-
hhuynh
-
Reporter: asi
-
February 20, 2007
-
0
-
Watchers: 0
-
November 07, 2008
-
May 24, 2007
Description
Currently, the tryLock(long timeout, TimeUnit unit) API is implemented at the client level. It periodically wakes up and do a tryLock(). It also ignores locks that are awarded greedily to other nodes when the lock is shared. A better implementation would be as follows:
- When the lock is shared, it sends a request to the server. If the lock is awarded greedily to another node, the server will try to perform a recall. If the recall can be obtained within the specified amount of time, the tryLock is successfully.
- If the lock is not shared, it will wait for the specified amount of time or when the lock is unlocked, whichever happens first.
Add new test cases in ReentrantLockTest and ReentrantReadWriteLockTest.