/** triggered if the last remaining upstream finished or failed */ protected void onFinish() { assert !paused : "must not receive a finish call if upstream should be paused"; for (Object[] objects : pauseFifo) { sharedRow.cells(objects); boolean wantMore = delegate.setNextRow(sharedRow); if (!wantMore) { break; } } delegate.finish(); }
protected boolean synchronizedSetNextRow(Row row) { if (paused) { pauseFifo.add(row.materialize()); return true; } else { Object[] bufferedCells; while ((bufferedCells = pauseFifo.poll()) != null) { sharedRow.cells(bufferedCells); boolean wantMore = delegate.setNextRow(sharedRow); if (!wantMore) { return false; } if (paused) { pauseFifo.add(row.materialize()); return true; } } return delegate.setNextRow(row); } }