if(batchListener != null)
batchListener.beforeFetchingNextBatch();
loadBatchIfNeeded();
if(cachedLastCols != null && cachedLastCols.hasPrevious()) {
Column<byte[]> col = cachedLastCols.previous();
IndexColumn indexedCol = CursorColumnSlice.convertToIndexCol(col, null);
return new Holder<IndexColumn>(indexedCol);
}
while(true) {
if(!theOneBatch.hasNext())
return null;
Future<OperationResult<ColumnList<byte[]>>> future = theOneBatch.next();
OperationResult<ColumnList<byte[]>> results = get(future);
ColumnList<byte[]> columnList = results.getResult();
cachedLastCols = new OurColumnListIterator(columnList);
while(cachedLastCols.hasNext())cachedLastCols.next();
if(cachedLastCols.hasPrevious()) {
Column<byte[]> col = cachedLastCols.previous();
IndexColumn indexCol = CursorColumnSlice.convertToIndexCol(col, null);
if(batchListener != null)
batchListener.afterFetchingNextBatch(columnList.size());
return new Holder<IndexColumn>(indexCol);
}