In JDBCAppender there are two ArrayLists: /** * ArrayList holding the buffer of Logging Events. */ protected ArrayList buffer;

  /**
   * Helper object for clearing out the buffer
   */
  protected ArrayList removes;

Why not just use one ArrayList instead of two to speed things up.
Using the ArrayList buffer as a FIFO-register could look like:
public synchronized void flushBuffer() {
//Do the actual logging
LoggingEvent logEvent = null;
while (buffer.size() >0) {
try {
logEvent = (LoggingEvent)buffer.remove(0);
} catch(Exception e) {
break;
}
try {
String sql = getLogStatement(logEvent);
execute(sql);
} catch (SQLException sqle) {
// Unable to store LogEvent i database, put it back in buffer.
if (logEvent != null) {
buffer.add(0, logEvent);
}
errorHandler.error("Failed to excute sql", sqle, ErrorCode.FLUSH_FAILURE);
}
}
}




Roland Nygren, Telia Promotor AB
Röstringning: 018 - 18 94 50 (säg: "Roland Nygren" eller "Roland Nygren på mobiltelefon")
Växel: 018 - 18 94 00
Direkt: 018 - 18 92 73
Mobil: 070 - 528 92 73
<http://www.promotor.telia.se/>http://www.promotor.telia.se/
__________________________


Security: Restricted

Reply via email to