Author: markt Date: Wed Nov 12 10:48:36 2014 New Revision: 1638743 URL: http://svn.apache.org/r1638743 Log: Add new lastAsyncStart property which is not currently used.
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=1638743&r1=1638742&r2=1638743&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java Wed Nov 12 10:48:36 2014 @@ -31,6 +31,7 @@ public abstract class SocketWrapperBase< private final AbstractEndpoint<E> endpoint; private volatile long lastAccess = System.currentTimeMillis(); + private volatile long lastAsyncStart = 0; private long timeout = -1; private boolean error = false; private volatile int keepAliveLeft = 100; @@ -84,7 +85,33 @@ public abstract class SocketWrapperBase< } public boolean isAsync() { return async; } - public void setAsync(boolean async) { this.async = async; } + /** + * Sets the async flag for this connection. If this call causes the + * connection to transition from non-async to async then the lastAsyncStart + * property will be set using the current time. This property is used as the + * start time when calculating the async timeout. As per the Servlet spec + * the async timeout applies once the dispatch where startAsync() was called + * has returned to the container (which is when this method is currently + * called). + * + * @param async The new value of for the async flag + */ + public void setAsync(boolean async) { + if (!this.async && async) { + lastAsyncStart = System.currentTimeMillis(); + } + this.async = async; + } + /** + * Obtain the time that this connection last transitioned to async + * processing. + * + * @return The time (as returned by {@link System#currentTimeMillis()}) that + * this connection last transitioned to async + */ + public long getLastAsyncStart() { + return lastAsyncStart; + } public boolean isUpgraded() { return upgraded; } public void setUpgraded(boolean upgraded) { this.upgraded = upgraded; } public boolean isSecure() { return secure; } @@ -164,6 +191,7 @@ public abstract class SocketWrapperBase< error = false; keepAliveLeft = 100; lastAccess = System.currentTimeMillis(); + lastAsyncStart = 0; localAddr = null; localName = null; localPort = -1; --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org