question: public void publishLogRecords ( final List < String > logRecords ) { int failedAttempts = 0 ; Iterator < String > iterator = logRecords . iterator ( ) ; while ( iterator . hasNext ( ) ) { String logRecord = iterator . next ( ) ; byte [ ] bytes = logRecord . getBytes ( Charset . forName ( "UTF-8" ) ) ; try { reconnect ( ) ; sendLogRecord ( bytes ) ; } catch ( IOException ioe ) { Debug . error ( "Unable to publish syslog records due to " + ioe . getMessage ( ) + "\nAudit record was: " + logRecord ) ; try { closeConnection ( ) ; } catch ( IOException ioe2 ) { } if ( ++ failedAttempts == MAX_ATTEMPT_LIMIT ) { while ( iterator . hasNext ( ) ) { Debug . error ( "Unable to publish syslog record due to non-transient network errors" + "\nAudit record was: " + iterator . next ( ) ) ; } } } } }
target:  Flush underlying connection. Sends buffered bytes as UDP datagram or as the next message on TCP stream. The real socket is (re)opened before, if necessary.