use of com.datastax.oss.driver.shaded.guava.common.collect.AbstractIterator in project dsbulk by datastax.
the class ContinuousReadResultSubscription method toPage.
@Override
Page toPage(ContinuousAsyncResultSet rs, ExecutionContext local) {
Iterator<Row> rows = rs.currentPage().iterator();
Iterator<ReadResult> results = new AbstractIterator<ReadResult>() {
@Override
protected ReadResult computeNext() {
if (rows.hasNext()) {
Row row = rows.next();
if (listener != null) {
listener.onRowReceived(row, local);
}
return new DefaultReadResult(statement, rs.getExecutionInfo(), row);
}
return endOfData();
}
};
return new ContinuousPage(rs, results);
}
use of com.datastax.oss.driver.shaded.guava.common.collect.AbstractIterator in project dsbulk by datastax.
the class ReadResultSubscription method toPage.
@Override
Page toPage(AsyncResultSet rs, ExecutionContext local) {
Iterator<Row> rows = rs.currentPage().iterator();
Iterator<ReadResult> results = new AbstractIterator<ReadResult>() {
@Override
protected ReadResult computeNext() {
if (rows.hasNext()) {
Row row = rows.next();
if (listener != null) {
listener.onRowReceived(row, local);
}
return new DefaultReadResult(statement, rs.getExecutionInfo(), row);
}
return endOfData();
}
};
return new Page(results, rs.hasMorePages() ? rs::fetchNextPage : null);
}
Aggregations