public void shutdown ( ) { // Prevent new entries from being added ... this . addEntries . set ( false ) ; // Mark the cursor as being finished; this will stop all consumers from waiting for a batch ... this . cursor . complete ( ) ; // Each of the consumer threads will complete the batch they're working on, but will then terminate ... // Stop the garbage collection thread (if running) ... if ( this . gcConsumer != null ) this . gcConsumer . close ( ) ; // Now, block until all the runners have completed ... for ( ConsumerRunner runner : new HashSet <> ( consumers ) ) { // use a copy of the runners; they're removed when they close runner . waitForCompletion ( ) ; } assert consumers . isEmpty ( ) ; }
Shutdown this ring buffer by preventing any further entries but allowing all existing entries to be processed by all consumers .