diff --git a/src/main/java/org/redisson/RedissonCountDownLatch.java b/src/main/java/org/redisson/RedissonCountDownLatch.java index 658477459..bfbdb94c0 100644 --- a/src/main/java/org/redisson/RedissonCountDownLatch.java +++ b/src/main/java/org/redisson/RedissonCountDownLatch.java @@ -88,17 +88,14 @@ public class RedissonCountDownLatch implements RCountDownLatch { public boolean await(long time, TimeUnit unit) throws InterruptedException { time = unit.toMillis(time); while (getCount() > 0) { + if (time <= 0) { + return false; + } long current = System.currentTimeMillis(); // waiting for message - boolean res = msg.tryAcquire(time, TimeUnit.MILLISECONDS); - if (res) { - return true; - } + msg.tryAcquire(time, TimeUnit.MILLISECONDS); long elapsed = System.currentTimeMillis() - current; time -= elapsed; - if (time <= 0) { - return false; - } } return true; }