private void closeQueue ( Throwable causingException ) { // Close the operation queue and extract any outstanding Operations from it. Collection < CompletableOperation > remainingOperations = this . operationQueue . close ( ) ; if ( remainingOperations != null && remainingOperations . size ( ) > 0 ) { // If any outstanding Operations were left in the queue, they need to be failed. // If no other cause was passed, assume we are closing the queue because we are shutting down. Throwable failException = causingException != null ? causingException : new CancellationException ( ) ; cancelIncompleteOperations ( remainingOperations , failException ) ; } // The commit queue will auto-close when we are done and it itself is empty. We just need to unblock it in case // it was idle and waiting on a pending take() operation. this . commitQueue . cancelPendingTake ( ) ; }
Closes the Operation Queue and fails all Operations in it with the given exception .