public Collection<FpqEntry> pop(int batchSize) throws FpqSegmentNotInReadyState {
metaDataLock.readLock().lock();
try {
// segment must be in READY state
if (Status.READY != status) {
throw new FpqSegmentNotInReadyState();
}
// find out if enough data remains in the segment. if this segment has been removed, paged
// to disk, etc, the adjustment will detect that too
long remaining = numberOfOnlineEntries.addAndGet(-batchSize);
int available = batchSize + (int) remaining;