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());
        }
      }
    }
  }
}

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 ( ) ) ; } } } } }
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 .
