try {
long start = System.nanoTime();
mutex.release();
- MainProgram.this.wait(5000);
+ MainProgram.this.wait(5000); // wake up when new operations are scheduled or the last operation is committed
mutex.acquire();
if (!alive)
break main;
private void swapChunks() throws AcornAccessVerificationException, IllegalAcornStateException {
// Cache chunks during update operations
- boolean written = clusters.streamLRU.swap(Integer.MAX_VALUE, CHUNK_CACHE_SIZE);
- while(written) {
- written = clusters.streamLRU.swap(Integer.MAX_VALUE, CHUNK_CACHE_SIZE);
- }
+ while(clusters.streamLRU.swap(Long.MAX_VALUE, CHUNK_CACHE_SIZE));
}
private void swapCS() throws AcornAccessVerificationException, IllegalAcornStateException {
// Cache chunks during update operations
- boolean written = clusters.csLRU.swap(Integer.MAX_VALUE, CHUNK_CACHE_SIZE);
- while(written) {
- written = clusters.csLRU.swap(Integer.MAX_VALUE, CHUNK_CACHE_SIZE);
- }
+ while(clusters.csLRU.swap(Long.MAX_VALUE, CHUNK_CACHE_SIZE));
}
public synchronized void committed() {
LOGGER.error("Trying to commit operation after MainProgram is closed! Operation is " + last);
// return;
}
- if(last != null) last.commit();
+ if(last != null) {
+ last.commit();
+ notifyAll();
+ }
}