You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/02/15 10:44:12 UTC

svn commit: r1659906 - /tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

Author: markt
Date: Sun Feb 15 09:44:12 2015
New Revision: 1659906

URL: http://svn.apache.org/r1659906
Log:
Make readTimeout and wrietTimeout volatile because they are written on a different thread than they are read on within a single request.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java?rev=1659906&r1=1659905&r2=1659906&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java Sun Feb 15 09:44:12 2015
@@ -37,12 +37,15 @@ public abstract class SocketWrapperBase<
     private volatile E socket;
     private final AbstractEndpoint<E> endpoint;
 
+    // Volatile because I/O and setting the timeout values occurs on a different
+    // thread to the thread checking the timeout.
     private volatile long lastRead = System.currentTimeMillis();
     private volatile long lastWrite = lastRead;
     private volatile long lastAsyncStart = 0;
     private volatile long asyncTimeout = -1;
-    private long readTimeout = -1;
-    private long writeTimeout = -1;
+    private volatile long readTimeout = -1;
+    private volatile long writeTimeout = -1;
+
     private IOException error = null;
     private volatile int keepAliveLeft = 100;
     private volatile boolean async = false;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org