RedissonLock.tryLock with timeout fixed

pull/6/head
Nikita 11 years ago
parent aa99e60ceb
commit fcd1442156

@ -95,7 +95,10 @@ public class RedissonLock implements Lock {
while (!tryLock()) { while (!tryLock()) {
long current = System.currentTimeMillis(); long current = System.currentTimeMillis();
// waiting for message // waiting for message
msg.tryAcquire(time, TimeUnit.MILLISECONDS); boolean res = msg.tryAcquire(time, TimeUnit.MILLISECONDS);
if (res) {
return true;
}
long elapsed = System.currentTimeMillis() - current; long elapsed = System.currentTimeMillis() - current;
time -= elapsed; time -= elapsed;
if (time <= 0) { if (time <= 0) {

Loading…
Cancel
Save