/** Try to flush the delayed write queue - only happens if there are no active transactions */ synchronized public void flush() { processDelayedReplayQueue(null) ; }
private boolean startExclusiveMode(boolean canBlock) { if ( canBlock ) { exclusivitylock.writeLock().lock() ; processDelayedReplayQueue(null); return true ; } boolean b = exclusivitylock.writeLock().tryLock() ; if ( ! b ) return false ; processDelayedReplayQueue(null); return true ; }
synchronized public void closedown() { processDelayedReplayQueue(null) ; journal.close() ; }
private void readerFinishesWorker(Transaction txn) { if ( checkForJournalFlush() ) processDelayedReplayQueue(txn) ; }
private void writerAbortsWorker(Transaction txn) { if ( checkForJournalFlush() ) processDelayedReplayQueue(txn) ; }
private void writerCommitsWorker(Transaction txn) { if ( activeReaders.get() == 0 && checkForJournalFlush() ) { // Can commit immediately. // Ensure the queue is empty though. // Could simply add txn to the commit queue and do it that way. if ( log() ) log("Commit immediately", txn) ; // Currently, all we need is // JournalControl.replay(txn) ; // because that plays queued transactions. // But for long term generallity, at the cost of one check of the journal size // we do this sequence. processDelayedReplayQueue(txn) ; enactTransaction(txn) ; JournalControl.replay(txn) ; } else { // Can't write back to the base database at the moment. commitedAwaitingFlush.add(txn) ; maxQueue = Math.max(commitedAwaitingFlush.size(), maxQueue) ; if ( log() ) log("Add to pending queue", txn) ; queue.add(txn) ; } }