/** * Forcefully counts down an operation and executes the provided runnable * if all expected operations where executed */ void countDown() { assert counter.isCountedDown() == false : "more operations executed than specified"; if (counter.countDown()) { onFinish.run(); } }
@Override public void onCommit(TimeValue commitTime) { TimeValue ackTimeout = ackedTaskListener.ackTimeout(); if (ackTimeout == null) { ackTimeout = TimeValue.ZERO; } final TimeValue timeLeft = TimeValue.timeValueNanos(Math.max(0, ackTimeout.nanos() - commitTime.nanos())); if (timeLeft.nanos() == 0L) { onTimeout(); } else if (countDown.countDown()) { finish(); } else { this.ackTimeoutCallback = threadPool.schedule(timeLeft, ThreadPool.Names.GENERIC, this::onTimeout); // re-check if onNodeAck has not completed while we were scheduling the timeout if (countDown.isCountedDown()) { FutureUtils.cancel(ackTimeoutCallback); } } }
/** * Forcefully counts down an operation and executes the provided runnable * if all expected operations where executed */ void countDown() { assert counter.isCountedDown() == false : "more operations executed than specified"; if (counter.countDown()) { onFinish.run(); } }
/** * Forcefully counts down an operation and executes the provided runnable * if all expected operations where executed */ void countDown() { assert counter.isCountedDown() == false : "more operations executed than specified"; if (counter.countDown()) { onFinish.run(); } }
/** * Forcefully counts down an operation and executes the provided runnable * if all expected operations where executed */ void countDown() { assert counter.isCountedDown() == false : "more operations executed than specified"; if (counter.countDown()) { onFinish.run(); } }
@Override public void onCommit(TimeValue commitTime) { TimeValue ackTimeout = ackedTaskListener.ackTimeout(); if (ackTimeout == null) { ackTimeout = TimeValue.ZERO; } final TimeValue timeLeft = TimeValue.timeValueNanos(Math.max(0, ackTimeout.nanos() - commitTime.nanos())); if (timeLeft.nanos() == 0L) { onTimeout(); } else if (countDown.countDown()) { finish(); } else { this.ackTimeoutCallback = threadPool.schedule(timeLeft, ThreadPool.Names.GENERIC, this::onTimeout); // re-check if onNodeAck has not completed while we were scheduling the timeout if (countDown.isCountedDown()) { FutureUtils.cancel(ackTimeoutCallback); } } }
@Override public void onCommit(TimeValue commitTime) { TimeValue ackTimeout = ackedTaskListener.ackTimeout(); if (ackTimeout == null) { ackTimeout = TimeValue.ZERO; } final TimeValue timeLeft = TimeValue.timeValueNanos(Math.max(0, ackTimeout.nanos() - commitTime.nanos())); if (timeLeft.nanos() == 0L) { onTimeout(); } else if (countDown.countDown()) { finish(); } else { this.ackTimeoutCallback = threadPool.schedule(timeLeft, ThreadPool.Names.GENERIC, this::onTimeout); // re-check if onNodeAck has not completed while we were scheduling the timeout if (countDown.isCountedDown()) { FutureUtils.cancel(ackTimeoutCallback); } } }
public void run() { if (expectedOps.isCountedDown()) { listener.onResponse(new ClearScrollResponse(true, 0)); return;
public void run() { if (expectedOps.isCountedDown()) { listener.onResponse(new ClearScrollResponse(true, 0)); return;