Author: markt Date: Wed Nov 12 10:49:07 2014 New Revision: 1638749 URL: http://svn.apache.org/r1638749 Log: Simplify handling of tiemouts now that async timeout has been separated from read/write timeout.
Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java tomcat/trunk/java/org/apache/coyote/ajp/AjpNio2Processor.java tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java?rev=1638749&r1=1638748&r2=1638749&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Wed Nov 12 10:49:07 2014 @@ -678,7 +678,6 @@ public abstract class AbstractAjpProcess if(!getAdapter().asyncDispatch(request, response, status)) { setErrorState(ErrorState.CLOSE_NOW, null); } - resetTimeouts(); } catch (InterruptedIOException e) { setErrorState(ErrorState.CLOSE_NOW, e); } catch (Throwable t) { @@ -697,6 +696,10 @@ public abstract class AbstractAjpProcess return SocketState.LONG; } } else { + // Set keep alive timeout for next request if enabled + if (keepAliveTimeout > 0) { + socketWrapper.setTimeout(keepAliveTimeout); + } request.updateCounters(); if (getErrorState().isError()) { return SocketState.CLOSED; @@ -841,7 +844,7 @@ public abstract class AbstractAjpProcess request.updateCounters(); rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE); - // Set keep alive timeout if enabled + // Set keep alive timeout for next request if enabled if (keepAliveTimeout > 0) { socketWrapper.setTimeout(keepAliveTimeout); } @@ -919,14 +922,6 @@ public abstract class AbstractAjpProcess // ------------------------------------------------------ Protected Methods - // Methods called by asyncDispatch - /** - * Provides a mechanism for those connector implementations (currently only - * NIO) that need to reset timeouts from Async timeouts to standard HTTP - * timeouts once async processing completes. - */ - protected abstract void resetTimeouts(); - // Methods called by prepareResponse() protected abstract int output(byte[] src, int offset, int length, boolean block) throws IOException; Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java?rev=1638749&r1=1638748&r2=1638749&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Wed Nov 12 10:49:07 2014 @@ -79,12 +79,6 @@ public class AjpAprProcessor extends Abs socketWrapper.getSocket().longValue(), -1, read, write); } - @Override - protected void resetTimeouts() { - // NO-OP. The AJP APR/native connector only uses the timeout value on - // time SocketWrapper for async timeouts. - } - @Override protected void setupSocket(SocketWrapperBase<Long> socketWrapper) { Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpNio2Processor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpNio2Processor.java?rev=1638749&r1=1638748&r2=1638749&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ajp/AjpNio2Processor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpNio2Processor.java Wed Nov 12 10:49:07 2014 @@ -99,25 +99,6 @@ public class AjpNio2Processor extends Ab // already be pending } - @Override - protected void resetTimeouts() { - // The NIO connector uses the timeout configured on the wrapper in the - // poller. Therefore, it needs to be reset once asycn processing has - // finished. - if (!getErrorState().isError() && socketWrapper != null && - asyncStateMachine.isAsyncDispatching()) { - long soTimeout = endpoint.getSoTimeout(); - - //reset the timeout - if (keepAliveTimeout > 0) { - socketWrapper.setTimeout(keepAliveTimeout); - } else { - socketWrapper.setTimeout(soTimeout); - } - } - - } - @Override protected void setupSocket(SocketWrapperBase<Nio2Channel> socketWrapper) Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java?rev=1638749&r1=1638748&r2=1638749&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java Wed Nov 12 10:49:07 2014 @@ -78,28 +78,6 @@ public class AjpNioProcessor extends Abs @Override - protected void resetTimeouts() { - // The NIO connector uses the timeout configured on the wrapper in the - // poller. Therefore, it needs to be reset once asycn processing has - // finished. - final NioEndpoint.NioSocketWrapper attach = - (NioEndpoint.NioSocketWrapper)socketWrapper.getSocket().getAttachment(false); - if (!getErrorState().isError() && attach != null && - asyncStateMachine.isAsyncDispatching()) { - long soTimeout = endpoint.getSoTimeout(); - - //reset the timeout - if (keepAliveTimeout > 0) { - attach.setTimeout(keepAliveTimeout); - } else { - attach.setTimeout(soTimeout); - } - } - - } - - - @Override protected void setupSocket(SocketWrapperBase<NioChannel> socketWrapper) throws IOException { // NO-OP --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org