}
}
}
persistBatchReferences();
synchronized (this) {
TupleBatch batch = this.activeBatch;
if (batch != null){
return batch;
}
Reference<TupleBatch> ref = this.batchReference;
this.batchReference = null;
if (ref != null) {
batch = ref.get();
if (batch != null) {
if (cache) {
this.activeBatch = batch;
addToCache(true);
}
referenceHit.getAndIncrement();
return batch;
}
}
long count = readCount.incrementAndGet();
LogManager.logDetail(LogConstants.CTX_BUFFER_MGR, batchManager.id, id, "reading batch from disk, total reads:", count); //$NON-NLS-1$
try {
this.batchManager.compactionLock.readLock().lock();
long[] info = batchManager.physicalMapping.get(this.id);
ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(batchManager.store.createInputStream(info[0]), IO_BUFFER_SIZE));
batch = new TupleBatch();
batch.setDataTypes(types);
batch.readExternal(ois);
batch.setRowOffset(this.beginRow);
batch.setDataTypes(null);
if (lobManager != null) {
for (List<?> tuple : batch.getTuples()) {
lobManager.updateReferences(batchManager.lobIndexes, tuple);
}
}
if (cache) {
this.activeBatch = batch;