private boolean processPendingWrites ( ) { long traceId = LoggerHelpers . traceEnterWithContext ( log , this . traceObjectId , "processPendingWrites" ) ; // Clean up the write queue of all finished writes that are complete (successfully or failed for good) val cs = this . writes . removeFinishedWrites ( ) ; if ( cs == WriteQueue . CleanupStatus . WriteFailed ) { // We encountered a failed write. As such, we must close immediately and not process anything else. // Closing will automatically cancel all pending writes. close ( ) ; LoggerHelpers . traceLeave ( log , this . traceObjectId , "processPendingWrites" , traceId , cs ) ; return false ; } else if ( cs == WriteQueue . CleanupStatus . QueueEmpty ) { // Queue is empty - nothing else to do. LoggerHelpers . traceLeave ( log , this . traceObjectId , "processPendingWrites" , traceId , cs ) ; return true ; } // Get the writes to execute from the queue. List < Write > toExecute = getWritesToExecute ( ) ; // Execute the writes, if any. boolean success = true ; if ( ! toExecute . isEmpty ( ) ) { success = executeWrites ( toExecute ) ; if ( success ) { // After every run where we did write, check if need to trigger a rollover. this . rolloverProcessor . runAsync ( ) ; } } LoggerHelpers . traceLeave ( log , this . traceObjectId , "processPendingWrites" , traceId , toExecute . size ( ) , success ) ; return success ; }
Executes pending Writes to BookKeeper . This method is not thread safe and should only be invoked as part of the Write Processor .