Author: markt Date: Tue Jun 30 18:30:45 2009 New Revision: 789865 URL: http://svn.apache.org/viewvc?rev=789865&view=rev Log: Use statics to reduce number of instances to one per thread rather than one per thread per access log. Also make thread local final as per discussion on dev list.
Modified: tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java Modified: tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java?rev=789865&r1=789864&r2=789865&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java (original) +++ tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java Tue Jun 30 18:30:45 2009 @@ -248,7 +248,7 @@ * is true. */ protected File currentLogFile = null; - private class AccessDateStruct { + private static class AccessDateStruct { private Date currentDate = new Date(); private String currentDateString = null; private SimpleDateFormat dayFormatter = new SimpleDateFormat("dd"); @@ -256,10 +256,11 @@ private SimpleDateFormat yearFormatter = new SimpleDateFormat("yyyy"); private SimpleDateFormat timeFormatter = new SimpleDateFormat("HH:mm:ss"); public AccessDateStruct() { - dayFormatter.setTimeZone(timezone); - monthFormatter.setTimeZone(timezone); - yearFormatter.setTimeZone(timezone); - timeFormatter.setTimeZone(timezone); + TimeZone tz = TimeZone.getDefault(); + dayFormatter.setTimeZone(tz); + monthFormatter.setTimeZone(tz); + yearFormatter.setTimeZone(tz); + timeFormatter.setTimeZone(tz); } } @@ -267,7 +268,8 @@ * The system time when we last updated the Date that this valve * uses for log lines. */ - private ThreadLocal<AccessDateStruct> currentDateStruct = new ThreadLocal<AccessDateStruct>() { + private static final ThreadLocal<AccessDateStruct> currentDateStruct = + new ThreadLocal<AccessDateStruct>() { protected AccessDateStruct initialValue() { return new AccessDateStruct(); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org