/** * Forcefully finish execution of all batches. */ void cancel() { lock.lock(); try { cancelled = true; if (curBatch != null) curBatch.finish(); if (nextBatch != null) nextBatch.finish(); cond.signalAll(); // Awake the main loop in case it is still waiting for the next batch. } finally { lock.unlock(); } }
/** * Forcefully finish execution of all batches. */ void cancel() { lock.lock(); try { cancelled = true; if (curBatch != null) curBatch.finish(); if (nextBatch != null) nextBatch.finish(); cond.signalAll(); // Awake the main loop in case it is still waiting for the next batch. } finally { lock.unlock(); } }
curBatch.finish(); // Mark the batch as finished if cancelled.
curBatch.finish(); // Mark the batch as finished if cancelled.
assert batch != null; batch.finish();
assert batch != null; batch.finish();