private void handleShutdownQueue ( ) throws IOException { for ( MemcachedNode qa : nodesToShutdown ) { if ( ! addedQueue . contains ( qa ) ) { nodesToShutdown . remove ( qa ) ; metrics . decrementCounter ( SHUTD_QUEUE_METRIC ) ; Collection < Operation > notCompletedOperations = qa . destroyInputQueue ( ) ; if ( qa . getChannel ( ) != null ) { qa . getChannel ( ) . close ( ) ; qa . setSk ( null ) ; if ( qa . getBytesRemainingToWrite ( ) > 0 ) { getLogger ( ) . warn ( "Shut down with %d bytes remaining to write" , qa . getBytesRemainingToWrite ( ) ) ; } getLogger ( ) . debug ( "Shut down channel %s" , qa . getChannel ( ) ) ; } redistributeOperations ( notCompletedOperations ) ; } } }
Check if nodes need to be shut down and do so if needed .