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 2014/02/12 15:26:13 UTC

svn commit: r1567632 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/coyote/ java/org/apache/coyote/ajp/ java/org/apache/coyote/http11/ webapps/docs/

Author: markt
Date: Wed Feb 12 14:26:13 2014
New Revision: 1567632

URL: http://svn.apache.org/r1567632
Log:
Back-port some refactoring required for an async timeout fix.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/coyote/AbstractProcessor.java
    tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
    tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java
    tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
    tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
    tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
    tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
    tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1512034

Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/AbstractProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/AbstractProcessor.java?rev=1567632&r1=1567631&r2=1567632&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/AbstractProcessor.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/AbstractProcessor.java Wed Feb 12 14:26:13 2014
@@ -35,6 +35,7 @@ public abstract class AbstractProcessor<
     protected AbstractEndpoint endpoint;
     protected Request request;
     protected Response response;
+    protected SocketWrapper<S> socketWrapper = null;
 
     
     /**
@@ -54,7 +55,6 @@ public abstract class AbstractProcessor<
         response = new Response();
         response.setHook(this);
         request.setResponse(response);
-
     }
 
 
@@ -96,6 +96,22 @@ public abstract class AbstractProcessor<
 
 
     /**
+     * Set the socket wrapper being used.
+     */
+    protected final void setSocketWrapper(SocketWrapper<S> socketWrapper) {
+        this.socketWrapper = socketWrapper;
+    }
+
+
+    /**
+     * Get the socket wrapper being used.
+     */
+    protected final SocketWrapper<S> getSocketWrapper() {
+        return socketWrapper;
+    }
+
+
+    /**
      * Obtain the Executor used by the underlying endpoint.
      */
     @Override

Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java?rev=1567632&r1=1567631&r2=1567632&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Wed Feb 12 14:26:13 2014
@@ -74,13 +74,6 @@ public class AjpAprProcessor extends Abs
 
     // ----------------------------------------------------- Instance Variables
 
-
-    /**
-     * Socket associated with the current connection.
-     */
-    protected SocketWrapper<Long> socket;
-
-
     /**
      * Direct buffer used for input.
      */
@@ -109,7 +102,7 @@ public class AjpAprProcessor extends Abs
         rp.setStage(org.apache.coyote.Constants.STAGE_PARSE);
 
         // Setting up the socket
-        this.socket = socket;
+        this.socketWrapper = socket;
         long socketRef = socket.getSocket().longValue();
         Socket.setrbb(socketRef, inputBuffer);
         Socket.setsbb(socketRef, outputBuffer);
@@ -260,18 +253,18 @@ public class AjpAprProcessor extends Abs
 
         if (actionCode == ActionCode.ASYNC_COMPLETE) {
             if (asyncStateMachine.asyncComplete()) {
-                ((AprEndpoint)endpoint).processSocketAsync(this.socket,
+                ((AprEndpoint)endpoint).processSocketAsync(this.socketWrapper,
                         SocketStatus.OPEN_READ);
             }
 
         } else if (actionCode == ActionCode.ASYNC_SETTIMEOUT) {
             if (param == null) return;
             long timeout = ((Long)param).longValue();
-            socket.setTimeout(timeout);
+            socketWrapper.setTimeout(timeout);
 
         } else if (actionCode == ActionCode.ASYNC_DISPATCH) {
             if (asyncStateMachine.asyncDispatch()) {
-                ((AprEndpoint)endpoint).processSocketAsync(this.socket,
+                ((AprEndpoint)endpoint).processSocketAsync(this.socketWrapper,
                         SocketStatus.OPEN_READ);
             }
         }
@@ -290,7 +283,7 @@ public class AjpAprProcessor extends Abs
             throws IOException {
         outputBuffer.put(src, offset, length);
         
-        long socketRef = socket.getSocket().longValue();
+        long socketRef = socketWrapper.getSocket().longValue();
         
         if (outputBuffer.position() > 0) {
             if ((socketRef != 0) && Socket.sendbb(socketRef, 0, outputBuffer.position()) < 0) {
@@ -320,7 +313,7 @@ public class AjpAprProcessor extends Abs
         int nRead;
         while (inputBuffer.remaining() < n) {
             nRead = Socket.recvbb
-                (socket.getSocket().longValue(), inputBuffer.limit(),
+                (socketWrapper.getSocket().longValue(), inputBuffer.limit(),
                         inputBuffer.capacity() - inputBuffer.limit());
             if (nRead > 0) {
                 inputBuffer.limit(inputBuffer.limit() + nRead);
@@ -353,7 +346,7 @@ public class AjpAprProcessor extends Abs
         int nRead;
         while (inputBuffer.remaining() < n) {
             nRead = Socket.recvbb
-                (socket.getSocket().longValue(), inputBuffer.limit(),
+                (socketWrapper.getSocket().longValue(), inputBuffer.limit(),
                     inputBuffer.capacity() - inputBuffer.limit());
             if (nRead > 0) {
                 inputBuffer.limit(inputBuffer.limit() + nRead);

Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java?rev=1567632&r1=1567631&r2=1567632&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java Wed Feb 12 14:26:13 2014
@@ -66,13 +66,6 @@ public class AjpNioProcessor extends Abs
 
     // ----------------------------------------------------- Instance Variables
 
-
-    /**
-     * Socket associated with the current connection.
-     */
-    protected NioChannel socket;
-
-    
     /**
      * Selector pool for the associated endpoint.
      */
@@ -95,7 +88,7 @@ public class AjpNioProcessor extends Abs
         rp.setStage(org.apache.coyote.Constants.STAGE_PARSE);
 
         // Setting up the socket
-        this.socket = socket.getSocket();
+        this.socketWrapper = socket;
         
         long soTimeout = endpoint.getSoTimeout();
         boolean cping = false;
@@ -252,19 +245,20 @@ public class AjpNioProcessor extends Abs
 
         if (actionCode == ActionCode.ASYNC_COMPLETE) {
             if (asyncStateMachine.asyncComplete()) {
-                ((NioEndpoint)endpoint).processSocket(this.socket,
+                ((NioEndpoint)endpoint).processSocket(this.socketWrapper.getSocket(),
                         SocketStatus.OPEN_READ, false);
             }
 
         } else if (actionCode == ActionCode.ASYNC_SETTIMEOUT) {
             if (param == null) return;
             long timeout = ((Long)param).longValue();
-            final KeyAttachment ka = (KeyAttachment)socket.getAttachment(false);
+            final KeyAttachment ka =
+                    (KeyAttachment)socketWrapper.getSocket().getAttachment(false);
             ka.setTimeout(timeout);
 
         } else if (actionCode == ActionCode.ASYNC_DISPATCH) {
             if (asyncStateMachine.asyncDispatch()) {
-                ((NioEndpoint)endpoint).processSocket(this.socket,
+                ((NioEndpoint)endpoint).processSocket(this.socketWrapper.getSocket(),
                         SocketStatus.OPEN_READ, true);
             }
         }
@@ -276,7 +270,8 @@ public class AjpNioProcessor extends Abs
         // 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 KeyAttachment attach = (KeyAttachment)socket.getAttachment(false);
+        final KeyAttachment attach =
+                (KeyAttachment)socketWrapper.getSocket().getAttachment(false);
         if (!error && attach != null &&
                 asyncStateMachine.isAsyncDispatching()) {
             long soTimeout = endpoint.getSoTimeout();
@@ -295,13 +290,15 @@ public class AjpNioProcessor extends Abs
     @Override
     protected void output(byte[] src, int offset, int length)
             throws IOException {
-        ByteBuffer writeBuffer = socket.getBufHandler() .getWriteBuffer();
+        ByteBuffer writeBuffer =
+                socketWrapper.getSocket().getBufHandler().getWriteBuffer();
 
         writeBuffer.put(src, offset, length);
         
         writeBuffer.flip();
         
-        NioEndpoint.KeyAttachment att = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
+        KeyAttachment att =
+                (KeyAttachment) socketWrapper.getSocket().getAttachment(false);
         if ( att == null ) throw new IOException("Key must be cancelled");
         long writeTimeout = att.getWriteTimeout();
         Selector selector = null;
@@ -311,7 +308,8 @@ public class AjpNioProcessor extends Abs
             //ignore
         }
         try {
-            pool.write(writeBuffer, socket, selector, writeTimeout, true);
+            pool.write(writeBuffer, socketWrapper.getSocket(), selector,
+                    writeTimeout, true);
         }finally { 
             if ( selector != null ) pool.put(selector);
         }
@@ -346,8 +344,10 @@ public class AjpNioProcessor extends Abs
     private int readSocket(byte[] buf, int pos, int n, boolean block)
             throws IOException {
         int nRead = 0;
-        socket.getBufHandler().getReadBuffer().clear();
-        socket.getBufHandler().getReadBuffer().limit(n);
+        ByteBuffer readBuffer =
+                socketWrapper.getSocket().getBufHandler().getReadBuffer();
+        readBuffer.clear();
+        readBuffer.limit(n);
         if ( block ) {
             Selector selector = null;
             try {
@@ -356,21 +356,23 @@ public class AjpNioProcessor extends Abs
                 // Ignore
             }
             try {
-                NioEndpoint.KeyAttachment att = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
+                NioEndpoint.KeyAttachment att =
+                        (NioEndpoint.KeyAttachment) socketWrapper.getSocket().getAttachment(false);
                 if ( att == null ) throw new IOException("Key must be cancelled.");
-                nRead = pool.read(socket.getBufHandler().getReadBuffer(),socket,selector,att.getTimeout());
+                nRead = pool.read(readBuffer, socketWrapper.getSocket(),
+                        selector, att.getTimeout());
             } catch ( EOFException eof ) {
                 nRead = -1;
             } finally { 
                 if ( selector != null ) pool.put(selector);
             }
         } else {
-            nRead = socket.read(socket.getBufHandler().getReadBuffer());
+            nRead = socketWrapper.getSocket().read(readBuffer);
         }
         if (nRead > 0) {
-            socket.getBufHandler().getReadBuffer().flip();
-            socket.getBufHandler().getReadBuffer().limit(nRead);
-            socket.getBufHandler().getReadBuffer().get(buf, pos, nRead);
+            readBuffer.flip();
+            readBuffer.limit(nRead);
+            readBuffer.get(buf, pos, nRead);
             return nRead;
         } else if (nRead == -1) {
             //return false;

Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=1567632&r1=1567631&r2=1567632&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Wed Feb 12 14:26:13 2014
@@ -69,13 +69,6 @@ public class AjpProcessor extends Abstra
 
     // ----------------------------------------------------- Instance Variables
 
-
-    /**
-     * Socket associated with the current connection.
-     */
-    protected SocketWrapper<Socket> socket;
-
-    
     /**
      * Input stream.
      */
@@ -104,7 +97,7 @@ public class AjpProcessor extends Abstra
         rp.setStage(org.apache.coyote.Constants.STAGE_PARSE);
 
         // Setting up the socket
-        this.socket = socket;
+        this.socketWrapper = socket;
         input = socket.getSocket().getInputStream();
         output = socket.getSocket().getOutputStream();
         int soTimeout = -1;
@@ -270,7 +263,7 @@ public class AjpProcessor extends Abstra
 
         if (actionCode == ActionCode.ASYNC_COMPLETE) {
             if (asyncStateMachine.asyncComplete()) {
-                ((JIoEndpoint)endpoint).processSocketAsync(this.socket,
+                ((JIoEndpoint)endpoint).processSocketAsync(this.socketWrapper,
                         SocketStatus.OPEN_READ);
             }
 
@@ -278,11 +271,11 @@ public class AjpProcessor extends Abstra
             if (param == null) return;
             long timeout = ((Long)param).longValue();
             // if we are not piggy backing on a worker thread, set the timeout
-            socket.setTimeout(timeout);
+            socketWrapper.setTimeout(timeout);
 
         } else if (actionCode == ActionCode.ASYNC_DISPATCH) {
             if (asyncStateMachine.asyncDispatch()) {
-                ((JIoEndpoint)endpoint).processSocketAsync(this.socket,
+                ((JIoEndpoint)endpoint).processSocketAsync(this.socketWrapper,
                         SocketStatus.OPEN_READ);
             }
         }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1567632&r1=1567631&r2=1567632&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Wed Feb 12 14:26:13 2014
@@ -672,12 +672,6 @@ public abstract class AbstractHttp11Proc
 
 
     /**
-     * Allows the super class to set the socket wrapper being used.
-     */
-    protected abstract void setSocketWrapper(SocketWrapper<S> socketWrapper);
-
-
-    /**
      * Exposes input buffer to super class to allow better code re-use.
      * @return  The input buffer used by the processor.
      */

Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=1567632&r1=1567631&r2=1567632&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java Wed Feb 12 14:26:13 2014
@@ -508,11 +508,6 @@ public class Http11AprProcessor extends 
     }
 
     @Override
-    protected void setSocketWrapper(SocketWrapper<Long> socketWrapper) {
-        this.socket = socketWrapper;
-    }
-
-    @Override
     protected AbstractInputBuffer<Long> getInputBuffer() {
         return inputBuffer;
     }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=1567632&r1=1567631&r2=1567632&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Wed Feb 12 14:26:13 2014
@@ -96,12 +96,6 @@ public class Http11NioProcessor extends 
     protected NioEndpoint.SendfileData sendfileData = null;
 
 
-    /**
-     * Socket associated with the current connection.
-     */
-    protected SocketWrapper<NioChannel> socket = null;
-
-
     // --------------------------------------------------------- Public Methods
 
 
@@ -118,7 +112,7 @@ public class Http11NioProcessor extends 
         long soTimeout = endpoint.getSoTimeout();
 
         RequestInfo rp = request.getRequestProcessor();
-        final NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getSocket().getAttachment(false);
+        final NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socketWrapper.getSocket().getAttachment(false);
         try {
             rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
             error = !adapter.event(request, response, status);
@@ -173,7 +167,7 @@ public class Http11NioProcessor extends 
 
     @Override
     protected void resetTimeouts() {
-        final NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getSocket().getAttachment(false);
+        final NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socketWrapper.getSocket().getAttachment(false);
         if (!error && attach != null &&
                 asyncStateMachine.isAsyncDispatching()) {
             long soTimeout = endpoint.getSoTimeout();
@@ -222,17 +216,17 @@ public class Http11NioProcessor extends 
         openSocket = true;
         // Check to see if we have read any of the request line yet
         if (inputBuffer.getParsingRequestLinePhase() < 2) {
-            if (socket.getLastAccess() > -1 || keptAlive) {
+            if (socketWrapper.getLastAccess() > -1 || keptAlive) {
                 // Haven't read the request line and have previously processed a
                 // request. Must be keep-alive. Make sure poller uses keepAlive.
-                socket.setTimeout(endpoint.getKeepAliveTimeout());
+                socketWrapper.setTimeout(endpoint.getKeepAliveTimeout());
             }
         } else {
             // Started to read request line. Need to keep processor
             // associated with socket
             readComplete = false;
             // Make sure poller uses soTimeout from here onwards
-            socket.setTimeout(endpoint.getSoTimeout());
+            socketWrapper.setTimeout(endpoint.getSoTimeout());
         }
         if (endpoint.isPaused()) {
             // 503 - Service unavailable
@@ -248,7 +242,7 @@ public class Http11NioProcessor extends 
 
     @Override
     protected void setSocketTimeout(int timeout) throws IOException {
-        socket.getSocket().getIOChannel().socket().setSoTimeout(timeout);
+        socketWrapper.getSocket().getIOChannel().socket().setSoTimeout(timeout);
     }
 
 
@@ -302,7 +296,7 @@ public class Http11NioProcessor extends 
 
     @Override
     public void recycleInternal() {
-        socket = null;
+        socketWrapper = null;
         sendfileData = null;
     }
 
@@ -322,8 +316,8 @@ public class Http11NioProcessor extends 
         if (actionCode == ActionCode.REQ_HOST_ADDR_ATTRIBUTE) {
 
             // Get remote host address
-            if ((remoteAddr == null) && (socket != null)) {
-                InetAddress inetAddr = socket.getSocket().getIOChannel().socket().getInetAddress();
+            if ((remoteAddr == null) && (socketWrapper != null)) {
+                InetAddress inetAddr = socketWrapper.getSocket().getIOChannel().socket().getInetAddress();
                 if (inetAddr != null) {
                     remoteAddr = inetAddr.getHostAddress();
                 }
@@ -333,8 +327,8 @@ public class Http11NioProcessor extends 
         } else if (actionCode == ActionCode.REQ_LOCAL_NAME_ATTRIBUTE) {
 
             // Get local host name
-            if ((localName == null) && (socket != null)) {
-                InetAddress inetAddr = socket.getSocket().getIOChannel().socket().getLocalAddress();
+            if ((localName == null) && (socketWrapper != null)) {
+                InetAddress inetAddr = socketWrapper.getSocket().getIOChannel().socket().getLocalAddress();
                 if (inetAddr != null) {
                     localName = inetAddr.getHostName();
                 }
@@ -344,8 +338,8 @@ public class Http11NioProcessor extends 
         } else if (actionCode == ActionCode.REQ_HOST_ATTRIBUTE) {
 
             // Get remote host name
-            if ((remoteHost == null) && (socket != null)) {
-                InetAddress inetAddr = socket.getSocket().getIOChannel().socket().getInetAddress();
+            if ((remoteHost == null) && (socketWrapper != null)) {
+                InetAddress inetAddr = socketWrapper.getSocket().getIOChannel().socket().getInetAddress();
                 if (inetAddr != null) {
                     remoteHost = inetAddr.getHostName();
                 }
@@ -362,22 +356,22 @@ public class Http11NioProcessor extends 
         } else if (actionCode == ActionCode.REQ_LOCAL_ADDR_ATTRIBUTE) {
 
             if (localAddr == null) {
-                localAddr = socket.getSocket().getIOChannel().socket().getLocalAddress().getHostAddress();
+                localAddr = socketWrapper.getSocket().getIOChannel().socket().getLocalAddress().getHostAddress();
             }
 
             request.localAddr().setString(localAddr);
 
         } else if (actionCode == ActionCode.REQ_REMOTEPORT_ATTRIBUTE) {
 
-            if ((remotePort == -1 ) && (socket !=null)) {
-                remotePort = socket.getSocket().getIOChannel().socket().getPort();
+            if ((remotePort == -1 ) && (socketWrapper !=null)) {
+                remotePort = socketWrapper.getSocket().getIOChannel().socket().getPort();
             }
             request.setRemotePort(remotePort);
 
         } else if (actionCode == ActionCode.REQ_LOCALPORT_ATTRIBUTE) {
 
-            if ((localPort == -1 ) && (socket !=null)) {
-                localPort = socket.getSocket().getIOChannel().socket().getLocalPort();
+            if ((localPort == -1 ) && (socketWrapper !=null)) {
+                localPort = socketWrapper.getSocket().getIOChannel().socket().getLocalPort();
             }
             request.setLocalPort(localPort);
 
@@ -423,7 +417,7 @@ public class Http11NioProcessor extends 
                     .setLimit(maxSavePostSize);
                 inputBuffer.addActiveFilter
                     (inputFilters[Constants.BUFFERED_FILTER]);
-                SecureNioChannel sslChannel = (SecureNioChannel) socket.getSocket();
+                SecureNioChannel sslChannel = (SecureNioChannel) socketWrapper.getSocket();
                 SSLEngine engine = sslChannel.getSslEngine();
                 if (!engine.getNeedClientAuth()) {
                     // Need to re-negotiate SSL connection
@@ -458,26 +452,26 @@ public class Http11NioProcessor extends 
         } else if (actionCode == ActionCode.COMET_END) {
             comet = false;
         }  else if (actionCode == ActionCode.COMET_CLOSE) {
-            if (socket==null || socket.getSocket().getAttachment(false)==null) {
+            if (socketWrapper==null || socketWrapper.getSocket().getAttachment(false)==null) {
                 return;
             }
-            NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getSocket().getAttachment(false);
+            NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socketWrapper.getSocket().getAttachment(false);
             attach.setCometOps(NioEndpoint.OP_CALLBACK);
             RequestInfo rp = request.getRequestProcessor();
             if (rp.getStage() != org.apache.coyote.Constants.STAGE_SERVICE) {
                 // Close event for this processor triggered by request
                 // processing in another processor, a non-Tomcat thread (i.e.
                 // an application controlled thread) or similar.
-                socket.getSocket().getPoller().add(socket.getSocket());
+                socketWrapper.getSocket().getPoller().add(socketWrapper.getSocket());
             }
         } else if (actionCode == ActionCode.COMET_SETTIMEOUT) {
             if (param==null) {
                 return;
             }
-            if (socket==null || socket.getSocket().getAttachment(false)==null) {
+            if (socketWrapper==null || socketWrapper.getSocket().getAttachment(false)==null) {
                 return;
             }
-            NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getSocket().getAttachment(false);
+            NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socketWrapper.getSocket().getAttachment(false);
             long timeout = ((Long)param).longValue();
             //if we are not piggy backing on a worker thread, set the timeout
             RequestInfo rp = request.getRequestProcessor();
@@ -486,23 +480,23 @@ public class Http11NioProcessor extends 
             }
         } else if (actionCode == ActionCode.ASYNC_COMPLETE) {
             if (asyncStateMachine.asyncComplete()) {
-                ((NioEndpoint)endpoint).processSocket(this.socket.getSocket(),
+                ((NioEndpoint)endpoint).processSocket(socketWrapper.getSocket(),
                         SocketStatus.OPEN_READ, true);
             }
         } else if (actionCode == ActionCode.ASYNC_SETTIMEOUT) {
             if (param==null) {
                 return;
             }
-            if (socket==null || socket.getSocket().getAttachment(false)==null) {
+            if (socketWrapper==null || socketWrapper.getSocket().getAttachment(false)==null) {
                 return;
             }
-            NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getSocket().getAttachment(false);
+            NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socketWrapper.getSocket().getAttachment(false);
             long timeout = ((Long)param).longValue();
             //if we are not piggy backing on a worker thread, set the timeout
             attach.setTimeout(timeout);
         } else if (actionCode == ActionCode.ASYNC_DISPATCH) {
             if (asyncStateMachine.asyncDispatch()) {
-                ((NioEndpoint)endpoint).processSocket(this.socket.getSocket(),
+                ((NioEndpoint)endpoint).processSocket(socketWrapper.getSocket(),
                         SocketStatus.OPEN_READ, true);
             }
         }
@@ -537,11 +531,6 @@ public class Http11NioProcessor extends 
     }
 
     @Override
-    protected void setSocketWrapper(SocketWrapper<NioChannel> socketWrapper) {
-        this.socket = socketWrapper;
-    }
-
-    @Override
     protected AbstractInputBuffer<NioChannel> getInputBuffer() {
         return inputBuffer;
     }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java?rev=1567632&r1=1567631&r2=1567632&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java Wed Feb 12 14:26:13 2014
@@ -390,11 +390,6 @@ public class Http11Processor extends Abs
     }
 
     @Override
-    protected void setSocketWrapper(SocketWrapper<Socket> socketWrapper) {
-        this.socket = socketWrapper;
-    }
-
-    @Override
     protected AbstractInputBuffer<Socket> getInputBuffer() {
         return inputBuffer;
     }

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1567632&r1=1567631&r2=1567632&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Feb 12 14:26:13 2014
@@ -64,6 +64,14 @@
       </fix>
     </changelog>
   </subsection>
+  <subsection>
+    <changelog>
+      <scode>
+        Pull up <code>SocketWrapper</code> to <code>AbstractProcessor</code>.
+        (markt)
+      </scode>
+    </changelog>
+  </subsection>
 </section>
 <section name="Tomcat 7.0.51 (violetagg)" rtext="not released">
   <subsection name="Catalina">



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