Author: markt
Date: Fri Jun 19 12:40:56 2009
New Revision: 786483
URL: http://svn.apache.org/viewvc?rev=786483&view=rev
Log:
Add an additional volatile from a review of the associated benchmark tests.
Add a sync
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=786483&r1=786482&r2=786483&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java Fri Jun 19
12:40:56 2009
@@ -281,7 +281,7 @@
* 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 @@
}
// 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();
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]