log.debug("Building the index");
forEachOnDisk(false, false, new EntryFunctor() {
@Override
public boolean apply(int file, int offset, int size, byte[] serializedKey, byte[] serializedMetadata, byte[] serializedValue, long seqId, long expiration) throws IOException, ClassNotFoundException {
long prevSeqId;
while (seqId > (prevSeqId = maxSeqId.get()) && !maxSeqId.compareAndSet(prevSeqId, seqId));
Object key = marshaller.objectFromByteBuffer(serializedKey);
if (trace) log.tracef("Loaded %d:%d (seqId %d, expiration %d)", file, offset, seqId, expiration);
try {
// We may check the seqId safely as we are the only thread writing to index
EntryPosition entry = temporaryTable.get(key);