@Override public boolean await(long time, TimeUnit unit) throws InterruptedException { long remainTime = unit.toMillis(time); long current = System.currentTimeMillis(); RFuture<RedissonCountDownLatchEntry> promise = subscribe(); if (!await(promise, time, unit)) { return false; } try { remainTime -= (System.currentTimeMillis() - current); if (remainTime <= 0) { return false; } while (getCount() > 0) { if (remainTime <= 0) { return false; } current = System.currentTimeMillis(); // waiting for open state RedissonCountDownLatchEntry entry = getEntry(); if (entry != null) { entry.getLatch().await(remainTime, TimeUnit.MILLISECONDS); } remainTime -= (System.currentTimeMillis() - current); } return true; } finally { unsubscribe(promise); } }
@Override public boolean await(long time, TimeUnit unit) throws InterruptedException { long remainTime = unit.toMillis(time); long current = System.currentTimeMillis(); RFuture<RedissonCountDownLatchEntry> promise = subscribe(); if (!await(promise, time, unit)) { return false; } try { remainTime -= (System.currentTimeMillis() - current); if (remainTime <= 0) { return false; } while (getCount() > 0) { if (remainTime <= 0) { return false; } current = System.currentTimeMillis(); // waiting for open state RedissonCountDownLatchEntry entry = getEntry(); if (entry != null) { entry.getLatch().await(remainTime, TimeUnit.MILLISECONDS); } remainTime -= (System.currentTimeMillis() - current); } return true; } finally { unsubscribe(promise); } }
public void await() throws InterruptedException { RFuture<RedissonCountDownLatchEntry> future = subscribe(); try { commandExecutor.syncSubscription(future); while (getCount() > 0) { // waiting for open state RedissonCountDownLatchEntry entry = getEntry(); if (entry != null) { entry.getLatch().await(); } } } finally { unsubscribe(future); } }
public void await() throws InterruptedException { RFuture<RedissonCountDownLatchEntry> future = subscribe(); try { commandExecutor.syncSubscription(future); while (getCount() > 0) { // waiting for open state RedissonCountDownLatchEntry entry = getEntry(); if (entry != null) { entry.getLatch().await(); } } } finally { unsubscribe(future); } }
@Override public boolean await(long time, TimeUnit unit) throws InterruptedException { long remainTime = unit.toMillis(time); long current = System.currentTimeMillis(); RFuture<RedissonCountDownLatchEntry> promise = subscribe(); if (!await(promise, time, unit)) { return false; } try { remainTime -= (System.currentTimeMillis() - current); if (remainTime <= 0) { return false; } while (getCount() > 0) { if (remainTime <= 0) { return false; } current = System.currentTimeMillis(); // waiting for open state RedissonCountDownLatchEntry entry = getEntry(); if (entry != null) { entry.getLatch().await(remainTime, TimeUnit.MILLISECONDS); } remainTime -= (System.currentTimeMillis() - current); } return true; } finally { unsubscribe(promise); } }
public void await() throws InterruptedException { RFuture<RedissonCountDownLatchEntry> future = subscribe(); try { commandExecutor.syncSubscription(future); while (getCount() > 0) { // waiting for open state RedissonCountDownLatchEntry entry = getEntry(); if (entry != null) { entry.getLatch().await(); } } } finally { unsubscribe(future); } }