@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) private void cleanupSessions ( List < String > storeNamesToCleanUp ) { logger . info ( "Performing cleanup" ) ; for ( String store : storeNamesToCleanUp ) { for ( Node node : nodesToStream ) { try { SocketAndStreams sands = nodeIdStoreToSocketAndStreams . get ( new Pair ( store , node . getId ( ) ) ) ; close ( sands . getSocket ( ) ) ; SocketDestination destination = nodeIdStoreToSocketRequest . get ( new Pair ( store , node . getId ( ) ) ) ; streamingSocketPool . checkin ( destination , sands ) ; } catch ( Exception ioE ) { logger . error ( ioE ) ; } } } cleanedUp = true ; }
Helper method to Close all open socket connections and checkin back to the pool