From: markt Date: Fri, 19 Jun 2009 12:40:56 +0000 (+0000) Subject: Add an additional volatile from a review of the associated benchmark tests. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=5edcb6bfb08904b8d6c5749fab515235b8dbfa5c;p=tomcat7.0 Add an additional volatile from a review of the associated benchmark tests. Add a sync to deal with the issue filip reported in the 5.5.x status file git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@786483 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/valves/AccessLogValve.java b/java/org/apache/catalina/valves/AccessLogValve.java index 7df274046..d5aba165f 100644 --- a/java/org/apache/catalina/valves/AccessLogValve.java +++ b/java/org/apache/catalina/valves/AccessLogValve.java @@ -281,7 +281,7 @@ public class AccessLogValve * The system time when we last updated the Date that this valve * uses for log lines. */ - private Date currentDate = null; + private volatile Date currentDate = null; private volatile long currentMillis = 0; @@ -690,10 +690,12 @@ public class AccessLogValve } // Log this message - if (writer != null) { - writer.println(message); - if (!buffered) { - writer.flush(); + synchronized(this) { + if (writer != null) { + writer.println(message); + if (!buffered) { + writer.flush(); + } } }