protected void handleIoException ( int attempt , IOException ioException ) throws IOException { if ( channel != null && channel . isOpen ( ) ) { try { channel . close ( ) ; } catch ( IOException e ) { LOGGER . warn ( "Failed to close channel after failed publish" , e ) ; } } channel = null ; if ( attempt == DEFAULT_RETRY_ATTEMPTS ) { throw ioException ; } try { Thread . sleep ( DEFAULT_RETRY_INTERVAL ) ; } catch ( InterruptedException e ) { LOGGER . warn ( "Sending message interrupted while waiting for retry attempt" , e ) ; } }
Handles an IOException depending on the already used attempts to send a message . Also performs a soft reset of the currently used channel .