@Override public void finish() { if (finished.compareAndSet(false, true)) { consumeRemaining(); downstream.finish(); } }
private void consumeRemaining() { if (prevRowMergingIterator == null) { return; } while (prevRowMergingIterator.hasNext()) { boolean wantMore = downstream.setNextRow(prevRowMergingIterator.next()); if (!wantMore) { break; } } }
@Override public void fail(Throwable e) { if (!finished.getAndSet(true)) { downstream.fail(e); } }