From 5edcb6bfb08904b8d6c5749fab515235b8dbfa5c Mon Sep 17 00:00:00 2001 From: markt Date: Fri, 19 Jun 2009 12:40:56 +0000 Subject: [PATCH] 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 --- java/org/apache/catalina/valves/AccessLogValve.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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(); + } } } -- 2.11.0