// Prevents read/write operations from starting while the
// volume is being closed.
//
final VolumeStorage storage = getStorage();
if (!storage.claim(true, timeout)) {
throw new InUseException("Unable to acquire claim on " + this);
}
try {
//
// BufferPool#invalidate may fail and return false if other
// threads hold claims on pages of this volume. In that case we
// need to back off all locks and retry
//
if (getStructure().getPool().invalidate(this)) {
getStructure().close();
getStorage().close();
getStatistics().reset();
break;
}
} finally {
storage.release();
}
if (System.currentTimeMillis() >= expiration) {
throw new InUseException("Unable invalidate all pages on " + this);
}
Util.sleep(Persistit.SHORT_DELAY);
}
}