use of org.neo4j.collection.RangeLongIterator in project neo4j by neo4j.
the class BaseCursorScan method reserveBatch.
@Override
public boolean reserveBatch(C cursor, int sizeHint) {
requirePositive(sizeHint);
LongIterator addedItems = ImmutableEmptyLongIterator.INSTANCE;
if (hasChanges && !addedItemsConsumed) {
// the idea here is to give each batch an exclusive range of the underlying
// memory so that each thread can read in parallel without contention.
int addedStart = addedChunk.getAndAdd(sizeHint);
if (addedStart < addedItemsArray.length) {
int batchSize = min(sizeHint, addedItemsArray.length - addedStart);
sizeHint -= batchSize;
addedItems = new RangeLongIterator(addedItemsArray, addedStart, batchSize);
} else {
addedItemsConsumed = true;
}
}
return scanStore(cursor, sizeHint, addedItems);
}
Aggregations