You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by xu...@apache.org on 2011/07/11 08:29:23 UTC

svn commit: r1145039 [2/2] - in /geronimo/external/trunk/tomcat-parent-7.0.18: ./ catalina/src/main/java/org/apache/catalina/connector/ catalina/src/main/java/org/apache/catalina/security/ catalina/src/main/java/org/apache/catalina/startup/ catalina/sr...

Modified: geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/ajp/AjpNioProtocol.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/ajp/AjpNioProtocol.java?rev=1145039&r1=1145038&r2=1145039&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/ajp/AjpNioProtocol.java (original)
+++ geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/ajp/AjpNioProtocol.java Mon Jul 11 06:29:23 2011
@@ -14,23 +14,19 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.coyote.ajp;
 
 import java.nio.channels.SocketChannel;
 import java.util.Iterator;
-import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.coyote.AbstractProtocol;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
-import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.net.AbstractEndpoint;
 import org.apache.tomcat.util.net.NioChannel;
 import org.apache.tomcat.util.net.NioEndpoint;
 import org.apache.tomcat.util.net.NioEndpoint.Handler;
 import org.apache.tomcat.util.net.SSLImplementation;
-import org.apache.tomcat.util.net.SocketStatus;
 import org.apache.tomcat.util.net.SocketWrapper;
 
 
@@ -90,16 +86,11 @@ public class AjpNioProtocol extends Abst
 
 
     protected static class AjpConnectionHandler
-            extends AbstractConnectionHandler implements Handler {
+            extends AbstractAjpConnectionHandler<NioChannel, AjpNioProcessor>
+            implements Handler {
 
         protected AjpNioProtocol proto;
 
-        protected ConcurrentHashMap<SocketWrapper<NioChannel>, AjpNioProcessor> connections =
-            new ConcurrentHashMap<SocketWrapper<NioChannel>, AjpNioProcessor>();
-
-        protected RecycledProcessors<AjpNioProcessor> recycledProcessors =
-            new RecycledProcessors<AjpNioProcessor>(this);
-
         public AjpConnectionHandler(AjpNioProtocol proto) {
             this.proto = proto;
         }
@@ -115,28 +106,27 @@ public class AjpNioProtocol extends Abst
         }
 
         @Override
-        public void recycle() {
-            recycledProcessors.clear();
-        }
-        
-        @Override
         public SSLImplementation getSslImplementation() {
             // AJP does not support SSL
             return null;
         }
 
+        /**
+         * Expected to be used by the Poller to release resources on socket
+         * close, errors etc.
+         */
         @Override
         public void release(SocketChannel socket) {
             if (log.isDebugEnabled()) 
                 log.debug("Iterating through our connections to release a socket channel:"+socket);
             boolean released = false;
-            Iterator<java.util.Map.Entry<SocketWrapper<NioChannel>, AjpNioProcessor>> it = connections.entrySet().iterator();
+            Iterator<java.util.Map.Entry<NioChannel, AjpNioProcessor>> it = connections.entrySet().iterator();
             while (it.hasNext()) {
-                java.util.Map.Entry<SocketWrapper<NioChannel>, AjpNioProcessor> entry = it.next();
-                if (entry.getKey().getSocket().getIOChannel()==socket) {
+                java.util.Map.Entry<NioChannel, AjpNioProcessor> entry = it.next();
+                if (entry.getKey().getIOChannel()==socket) {
                     it.remove();
                     AjpNioProcessor result = entry.getValue();
-                    result.recycle();
+                    result.recycle(true);
                     unregister(result);
                     released = true;
                     break;
@@ -147,94 +137,35 @@ public class AjpNioProtocol extends Abst
         }
         
         /**
-         * Use this only if the processor is not available, otherwise use
-         * {@link #release(SocketWrapper, AjpNioProcessor)}.
+         * Expected to be used by the Poller to release resources on socket
+         * close, errors etc.
          */
         @Override
         public void release(SocketWrapper<NioChannel> socket) {
             AjpNioProcessor processor = connections.remove(socket);
             if (processor != null) {
-                processor.recycle();
+                processor.recycle(true);
                 recycledProcessors.offer(processor);
             }
         }
 
-
+        /**
+         * Expected to be used by the handler once the processor is no longer
+         * required.
+         */
+        @Override
         public void release(SocketWrapper<NioChannel> socket,
-                AjpNioProcessor processor) {
-            connections.remove(socket);
-            processor.recycle();
+                AjpNioProcessor processor, boolean isSocketClosing,
+                boolean addToPoller) {
+            processor.recycle(isSocketClosing);
             recycledProcessors.offer(processor);
-        }
-
-        @Override
-        public SocketState process(SocketWrapper<NioChannel> socket,
-                SocketStatus status) {
-            AjpNioProcessor processor = connections.remove(socket);
-
-            socket.setAsync(false); //no longer check for timeout
-
-            try {
-                if (processor == null) {
-                    processor = recycledProcessors.poll();
-                }
-                if (processor == null) {
-                    processor = createProcessor();
-                }
-
-                SocketState state = SocketState.CLOSED;
-                do {
-                    if (processor.isAsync() || state == SocketState.ASYNC_END) {
-                        state = processor.asyncDispatch(status);
-                    } else {
-                        state = processor.process(socket);
-                    }
-
-                    if (state != SocketState.CLOSED && processor.isAsync()) {
-                        state = processor.asyncPostProcess();
-                    }
-                } while (state == SocketState.ASYNC_END);
-
-                if (state == SocketState.LONG) {
-                    // In the middle of processing a request/response. Keep the
-                    // socket associated with the processor.
-                    connections.put(socket, processor);
-                    
-                    socket.setAsync(true);
-                } else if (state == SocketState.OPEN){
-                    // In keep-alive but between requests. OK to recycle
-                    // processor. Continue to poll for the next request.
-                    release(socket, processor);
-                    socket.getSocket().getPoller().add(socket.getSocket());
-                } else {
-                    // Connection closed. OK to recycle the processor.
-                    release(socket, processor);
-                }
-                return state;
-
-            } catch(java.net.SocketException e) {
-                // SocketExceptions are normal
-                log.debug(sm.getString(
-                        "ajpprotocol.proto.socketexception.debug"), e);
-            } catch (java.io.IOException e) {
-                // IOExceptions are normal
-                log.debug(sm.getString(
-                        "ajpprotocol.proto.ioexception.debug"), e);
+            if (addToPoller) {
+                socket.getSocket().getPoller().add(socket.getSocket());
             }
-            // Future developers: if you discover any other
-            // rare-but-nonfatal exceptions, catch them here, and log as
-            // above.
-            catch (Throwable e) {
-                ExceptionUtils.handleThrowable(e);
-                // any other exception or error is odd. Here we log it
-                // with "ERROR" level, so it will show up even on
-                // less-than-verbose logs.
-                log.error(sm.getString("ajpprotocol.proto.error"), e);
-            }
-            release(socket, processor);
-            return SocketState.CLOSED;
         }
 
+
+        @Override
         protected AjpNioProcessor createProcessor() {
             AjpNioProcessor processor = new AjpNioProcessor(proto.packetSize, (NioEndpoint)proto.endpoint);
             processor.setAdapter(proto.adapter);

Modified: geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/ajp/AjpProcessor.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/ajp/AjpProcessor.java?rev=1145039&r1=1145038&r2=1145039&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/ajp/AjpProcessor.java Mon Jul 11 06:29:23 2011
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.coyote.ajp;
 
 import java.io.IOException;
@@ -31,8 +30,6 @@ import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.buf.ByteChunk;
-import org.apache.tomcat.util.buf.HexUtils;
-import org.apache.tomcat.util.http.HttpMessages;
 import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState;
 import org.apache.tomcat.util.net.JIoEndpoint;
 import org.apache.tomcat.util.net.SocketStatus;
@@ -50,7 +47,7 @@ import org.apache.tomcat.util.net.Socket
  * @author Costin Manolache
  * @author Bill Barker
  */
-public class AjpProcessor extends AbstractAjpProcessor {
+public class AjpProcessor extends AbstractAjpProcessor<Socket> {
 
 
     /**
@@ -70,13 +67,6 @@ public class AjpProcessor extends Abstra
         super(packetSize, endpoint);
 
         response.setOutputBuffer(new SocketOutputBuffer());
-
-        // Cause loading of HexUtils
-        HexUtils.load();
-
-        // Cause loading of HttpMessages
-        HttpMessages.getMessage(200);
-
     }
 
 
@@ -110,6 +100,7 @@ public class AjpProcessor extends Abstra
      *
      * @throws IOException error during an I/O operation
      */
+    @Override
     public SocketState process(SocketWrapper<Socket> socket)
         throws IOException {
         RequestInfo rp = request.getRequestProcessor();
@@ -237,7 +228,7 @@ public class AjpProcessor extends Abstra
             request.updateCounters();
 
             rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE);
-            recycle();
+            recycle(false);
         }
         
         rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
@@ -253,10 +244,12 @@ public class AjpProcessor extends Abstra
     }
 
     @Override
-    public void recycle() {
-        super.recycle();
-        input = null;
-        output = null;
+    public void recycle(boolean socketClosing) {
+        super.recycle(socketClosing);
+        if (socketClosing) {
+            input = null;
+            output = null;
+        }
     }
 
     // ----------------------------------------------------- ActionHook Methods

Modified: geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/ajp/AjpProtocol.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/ajp/AjpProtocol.java?rev=1145039&r1=1145038&r2=1145039&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/ajp/AjpProtocol.java (original)
+++ geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/ajp/AjpProtocol.java Mon Jul 11 06:29:23 2011
@@ -14,21 +14,17 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.coyote.ajp;
 
 import java.net.Socket;
-import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.coyote.AbstractProtocol;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
-import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.net.AbstractEndpoint;
 import org.apache.tomcat.util.net.JIoEndpoint;
 import org.apache.tomcat.util.net.JIoEndpoint.Handler;
 import org.apache.tomcat.util.net.SSLImplementation;
-import org.apache.tomcat.util.net.SocketStatus;
 import org.apache.tomcat.util.net.SocketWrapper;
 
 
@@ -89,16 +85,11 @@ public class AjpProtocol extends Abstrac
 
 
     protected static class AjpConnectionHandler
-            extends AbstractConnectionHandler implements Handler {
+            extends AbstractAjpConnectionHandler<Socket,AjpProcessor>
+            implements Handler {
 
         protected AjpProtocol proto;
 
-        protected ConcurrentHashMap<SocketWrapper<Socket>, AjpProcessor> connections =
-            new ConcurrentHashMap<SocketWrapper<Socket>, AjpProcessor>();
-
-        protected RecycledProcessors<AjpProcessor> recycledProcessors =
-            new RecycledProcessors<AjpProcessor>(this);
-
         public AjpConnectionHandler(AjpProtocol proto) {
             this.proto = proto;
         }
@@ -119,68 +110,25 @@ public class AjpProtocol extends Abstrac
             return null;
         }
 
+        /**
+         * Expected to be used by the handler once the processor is no longer
+         * required.
+         * 
+         * @param socket            Ignored for BIO
+         * @param processor
+         * @param isSocketClosing
+         * @param addToPoller       Ignored for BIO
+         */
         @Override
-        public void recycle() {
-            recycledProcessors.clear();
-        }
-        
-        @Override
-        public SocketState process(SocketWrapper<Socket> socket, SocketStatus status) {
-            AjpProcessor processor = connections.remove(socket);
-            try {
-                if (processor == null) {
-                    processor = recycledProcessors.poll();
-                }
-                if (processor == null) {
-                    processor = createProcessor();
-                }
-
-                SocketState state = SocketState.CLOSED;
-                do {
-                    if (processor.isAsync() || state == SocketState.ASYNC_END) {
-                        state = processor.asyncDispatch(status);
-                    } else {
-                        state = processor.process(socket);
-                    }
-    
-                    if (state != SocketState.CLOSED && processor.isAsync()) {
-                        state = processor.asyncPostProcess();
-                    }
-                } while (state == SocketState.ASYNC_END);
-                // TODO Better to add a new state to the AsyncStateMachine and
-                //      remove ASYNC_END entirely
-
-                if (state == SocketState.LONG) {
-                    connections.put(socket, processor);
-                } else {
-                    processor.recycle();
-                    recycledProcessors.offer(processor);
-                }
-                return state;
-            } catch(java.net.SocketException e) {
-                // SocketExceptions are normal
-                log.debug(sm.getString(
-                        "ajpprotocol.proto.socketexception.debug"), e);
-            } catch (java.io.IOException e) {
-                // IOExceptions are normal
-                log.debug(sm.getString(
-                        "ajpprotocol.proto.ioexception.debug"), e);
-            }
-            // Future developers: if you discover any other
-            // rare-but-nonfatal exceptions, catch them here, and log as
-            // above.
-            catch (Throwable e) {
-                ExceptionUtils.handleThrowable(e);
-                // any other exception or error is odd. Here we log it
-                // with "ERROR" level, so it will show up even on
-                // less-than-verbose logs.
-                log.error(sm.getString("ajpprotocol.proto.error"), e);
-            }
-            processor.recycle();
+        public void release(SocketWrapper<Socket> socket,
+                AjpProcessor processor, boolean isSocketClosing,
+                boolean addToPoller) {
+            processor.recycle(isSocketClosing);
             recycledProcessors.offer(processor);
-            return SocketState.CLOSED;
         }
 
+
+        @Override
         protected AjpProcessor createProcessor() {
             AjpProcessor processor = new AjpProcessor(proto.packetSize, (JIoEndpoint)proto.endpoint);
             processor.setAdapter(proto.adapter);

Modified: geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/AbstractHttp11Processor.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1145039&r1=1145038&r2=1145039&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/AbstractHttp11Processor.java (original)
+++ geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/AbstractHttp11Processor.java Mon Jul 11 06:29:23 2011
@@ -17,6 +17,7 @@
 package org.apache.coyote.http11;
 
 import java.io.IOException;
+import java.io.InterruptedIOException;
 import java.util.Locale;
 import java.util.StringTokenizer;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -25,6 +26,7 @@ import java.util.regex.Pattern;
 import org.apache.coyote.AbstractProcessor;
 import org.apache.coyote.ActionCode;
 import org.apache.coyote.AsyncContextCallback;
+import org.apache.coyote.RequestInfo;
 import org.apache.coyote.http11.filters.BufferedInputFilter;
 import org.apache.coyote.http11.filters.ChunkedInputFilter;
 import org.apache.coyote.http11.filters.ChunkedOutputFilter;
@@ -43,9 +45,11 @@ import org.apache.tomcat.util.buf.Messag
 import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.http.MimeHeaders;
 import org.apache.tomcat.util.net.AbstractEndpoint;
+import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState;
+import org.apache.tomcat.util.net.SocketStatus;
 import org.apache.tomcat.util.res.StringManager;
 
-public abstract class AbstractHttp11Processor extends AbstractProcessor {
+public abstract class AbstractHttp11Processor<S> extends AbstractProcessor<S> {
 
     protected abstract Log getLog();
 
@@ -100,6 +104,12 @@ public abstract class AbstractHttp11Proc
 
 
     /**
+     * Comet used.
+     */
+    protected boolean comet = false;
+
+
+    /**
      * Regular expression that defines the restricted user agents.
      */
     protected Pattern restrictedUserAgents = null;
@@ -1200,6 +1210,59 @@ public abstract class AbstractHttp11Proc
 
     }
 
+    
+    @Override
+    public SocketState asyncDispatch(SocketStatus status) {
+
+        RequestInfo rp = request.getRequestProcessor();
+        try {
+            rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
+            error = !adapter.asyncDispatch(request, response, status);
+            resetTimeouts();
+        } catch (InterruptedIOException e) {
+            error = true;
+        } catch (Throwable t) {
+            ExceptionUtils.handleThrowable(t);
+            getLog().error(sm.getString("http11processor.request.process"), t);
+            error = true;
+        } finally {
+            if (error) {
+                // 500 - Internal Server Error
+                response.setStatus(500);
+                adapter.log(request, response, 0);
+            }
+        }
+
+        rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
+
+        if (error) {
+            return SocketState.CLOSED;
+        } else if (isAsync()) {
+            return SocketState.LONG;
+        } else {
+            if (!keepAlive) {
+                return SocketState.CLOSED;
+            } else {
+                return SocketState.OPEN;
+            }
+        }
+    }
+
+
+    @Override
+    public boolean isComet() {
+        return comet;
+    }
+
+
+    /**
+     * 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();
+
+
     public void endRequest() {
 
         // Finish the handling of the request
@@ -1231,6 +1294,12 @@ public abstract class AbstractHttp11Proc
         getInputBuffer().recycle();
         getOutputBuffer().recycle();
         asyncStateMachine.recycle();
+        remoteAddr = null;
+        remoteHost = null;
+        localAddr = null;
+        localName = null;
+        remotePort = -1;
+        localPort = -1;
         recycleInternal();
     }
     

Modified: geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/AbstractHttp11Protocol.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/AbstractHttp11Protocol.java?rev=1145039&r1=1145038&r2=1145039&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/AbstractHttp11Protocol.java (original)
+++ geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/AbstractHttp11Protocol.java Mon Jul 11 06:29:23 2011
@@ -16,6 +16,7 @@
  */
 package org.apache.coyote.http11;
 
+
 import org.apache.coyote.AbstractProtocol;
 import org.apache.tomcat.util.res.StringManager;
 

Modified: geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11AprProcessor.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=1145039&r1=1145038&r2=1145039&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11AprProcessor.java (original)
+++ geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11AprProcessor.java Mon Jul 11 06:29:23 2011
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.coyote.http11;
 
 import java.io.ByteArrayInputStream;
@@ -34,7 +33,6 @@ import org.apache.tomcat.jni.SSLSocket;
 import org.apache.tomcat.jni.Sockaddr;
 import org.apache.tomcat.jni.Socket;
 import org.apache.tomcat.util.ExceptionUtils;
-import org.apache.tomcat.util.buf.HexUtils;
 import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState;
 import org.apache.tomcat.util.net.AprEndpoint;
 import org.apache.tomcat.util.net.SSLSupport;
@@ -47,7 +45,7 @@ import org.apache.tomcat.util.net.Socket
  *
  * @author Remy Maucherat
  */
-public class Http11AprProcessor extends AbstractHttp11Processor {
+public class Http11AprProcessor extends AbstractHttp11Processor<Long> {
 
 
     private static final Log log = LogFactory.getLog(Http11AprProcessor.class);
@@ -71,9 +69,6 @@ public class Http11AprProcessor extends 
         response.setOutputBuffer(outputBuffer);
 
         initializeFilters(maxTrailerSize);
-
-        // Cause loading of HexUtils
-        HexUtils.load();
     }
 
 
@@ -99,12 +94,6 @@ public class Http11AprProcessor extends 
 
 
     /**
-     * Comet used.
-     */
-    protected boolean comet = false;
-
-
-    /**
      * Socket associated with the current connection.
      */
     protected SocketWrapper<Long> socket = null;
@@ -133,6 +122,7 @@ public class Http11AprProcessor extends 
      *
      * @throws IOException error during an I/O operation
      */
+    @Override
     public SocketState event(SocketStatus status)
         throws IOException {
         
@@ -173,19 +163,12 @@ public class Http11AprProcessor extends 
      *
      * @throws IOException error during an I/O operation
      */
+    @Override
     public SocketState process(SocketWrapper<Long> socket)
         throws IOException {
         RequestInfo rp = request.getRequestProcessor();
         rp.setStage(org.apache.coyote.Constants.STAGE_PARSE);
 
-        // Set the remote address
-        remoteAddr = null;
-        remoteHost = null;
-        localAddr = null;
-        localName = null;
-        remotePort = -1;
-        localPort = -1;
-
         // Setting up the socket
         this.socket = socket;
         long socketRef = socket.getSocket().longValue();
@@ -344,39 +327,9 @@ public class Http11AprProcessor extends 
     }
 
 
-    public SocketState asyncDispatch(SocketStatus status) {
-
-        RequestInfo rp = request.getRequestProcessor();
-        try {
-            rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
-            error = !adapter.asyncDispatch(request, response, status);
-        } catch (InterruptedIOException e) {
-            error = true;
-        } catch (Throwable t) {
-            ExceptionUtils.handleThrowable(t);
-            log.error(sm.getString("http11processor.request.process"), t);
-            error = true;
-        } finally {
-            if (error) {
-                // 500 - Internal Server Error
-                response.setStatus(500);
-                adapter.log(request, response, 0);
-            }
-        }
-
-        rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
-
-        if (error) {
-            return SocketState.CLOSED;
-        } else if (isAsync()) {
-            return SocketState.LONG;
-        } else {
-            if (!keepAlive) {
-                return SocketState.CLOSED;
-            } else {
-                return SocketState.OPEN;
-            }
-        }
+    @Override
+    protected void resetTimeouts() {
+        // NOOP for APR
     }
 
 

Modified: geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11AprProtocol.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11AprProtocol.java?rev=1145039&r1=1145038&r2=1145039&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11AprProtocol.java (original)
+++ geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11AprProtocol.java Mon Jul 11 06:29:23 2011
@@ -14,19 +14,14 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.coyote.http11;
 
-import java.util.concurrent.ConcurrentHashMap;
-
 import org.apache.coyote.AbstractProtocol;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
-import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.net.AbstractEndpoint;
 import org.apache.tomcat.util.net.AprEndpoint;
 import org.apache.tomcat.util.net.AprEndpoint.Handler;
-import org.apache.tomcat.util.net.SocketStatus;
 import org.apache.tomcat.util.net.SocketWrapper;
 
 
@@ -182,16 +177,10 @@ public class Http11AprProtocol extends A
     // --------------------  Connection handler --------------------
 
     protected static class Http11ConnectionHandler
-            extends AbstractConnectionHandler implements Handler {
+            extends AbstractConnectionHandler<Long,Http11AprProcessor> implements Handler {
         
         protected Http11AprProtocol proto;
         
-        protected ConcurrentHashMap<Long, Http11AprProcessor> connections =
-            new ConcurrentHashMap<Long, Http11AprProcessor>();
-
-        protected RecycledProcessors<Http11AprProcessor> recycledProcessors =
-            new RecycledProcessors<Http11AprProcessor>(this);
-
         Http11ConnectionHandler(Http11AprProtocol proto) {
             this.proto = proto;
         }
@@ -210,88 +199,48 @@ public class Http11AprProtocol extends A
         public void recycle() {
             recycledProcessors.clear();
         }
-        
+
+        /**
+         * Expected to be used by the handler once the processor is no longer
+         * required.
+         * 
+         * @param socket
+         * @param processor
+         * @param isSocketClosing   Not used in HTTP
+         * @param addToPoller
+         */
         @Override
-        public SocketState process(SocketWrapper<Long> socket,
-                SocketStatus status) {
-            Http11AprProcessor processor =
-                connections.remove(socket.getSocket());
-            
-            socket.setAsync(false);
-
-            try {
-                if (processor == null) {
-                    processor = recycledProcessors.poll();
-                }
-                if (processor == null) {
-                    processor = createProcessor();
-                }
-
-                SocketState state = SocketState.CLOSED;
-                do {
-                    if (processor.isAsync() || state == SocketState.ASYNC_END) {
-                        state = processor.asyncDispatch(status);
-                    } else if (processor.comet) {
-                        state = processor.event(status);
-                    } else {
-                        state = processor.process(socket);
-                    }
-
-                    if (state != SocketState.CLOSED && processor.isAsync()) {
-                        state = processor.asyncPostProcess();
-                    }
-                } while (state == SocketState.ASYNC_END);
-
-                if (state == SocketState.LONG) {
-                    // In the middle of processing a request/response. Keep the
-                    // socket associated with the processor.
-                    connections.put(socket.getSocket(), processor);
-
-                    if (processor.isAsync()) {
-                        socket.setAsync(true);
-                    } else if (processor.comet) {
-                        ((AprEndpoint) proto.endpoint).getCometPoller().add(
-                                socket.getSocket().longValue());
-                    }
-                } else if (state == SocketState.OPEN){
-                    // In keep-alive but between requests. OK to recycle
-                    // processor. Continue to poll for the next request.
-                    processor.recycle();
-                    recycledProcessors.offer(processor);
-                    ((AprEndpoint)proto.endpoint).getPoller().add(
-                            socket.getSocket().longValue());
-                } else {
-                    // Connection closed. OK to recycle the processor.
-                    processor.recycle();
-                    recycledProcessors.offer(processor);
-                }
-                return state;
-
-            } catch (java.net.SocketException e) {
-                // SocketExceptions are normal
-                log.debug(sm.getString(
-                        "http11protocol.proto.socketexception.debug"), e);
-            } catch (java.io.IOException e) {
-                // IOExceptions are normal
-                log.debug(sm.getString(
-                        "http11protocol.proto.ioexception.debug"), e);
-            }
-            // Future developers: if you discover any other
-            // rare-but-nonfatal exceptions, catch them here, and log as
-            // above.
-            catch (Throwable e) {
-                ExceptionUtils.handleThrowable(e);
-                // any other exception or error is odd. Here we log it
-                // with "ERROR" level, so it will show up even on
-                // less-than-verbose logs.
-                Http11AprProtocol.log.error(
-                        sm.getString("http11protocol.proto.error"), e);
-            }
+        public void release(SocketWrapper<Long> socket,
+                Http11AprProcessor processor, boolean isSocketClosing,
+                boolean addToPoller) {
             processor.recycle();
             recycledProcessors.offer(processor);
-            return SocketState.CLOSED;
+            if (addToPoller) {
+                ((AprEndpoint)proto.endpoint).getPoller().add(
+                        socket.getSocket().longValue());
+            }
         }
 
+        @Override
+        protected void initSsl(SocketWrapper<Long> socket,
+                Http11AprProcessor processor) {
+            // NOOP for APR
+        }
+
+        @Override
+        protected void longPoll(SocketWrapper<Long> socket,
+                Http11AprProcessor processor) {
+            connections.put(socket.getSocket(), processor);
+
+            if (processor.isAsync()) {
+                socket.setAsync(true);
+            } else if (processor.comet) {
+                ((AprEndpoint) proto.endpoint).getCometPoller().add(
+                        socket.getSocket().longValue());
+            }
+        }
+
+        @Override
         protected Http11AprProcessor createProcessor() {
             Http11AprProcessor processor = new Http11AprProcessor(
                     proto.getMaxHttpHeaderSize(), (AprEndpoint)proto.endpoint,

Modified: geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=1145039&r1=1145038&r2=1145039&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java (original)
+++ geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java Mon Jul 11 06:29:23 2011
@@ -14,8 +14,8 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.coyote.http11;
+
 import java.io.IOException;
 import java.io.InterruptedIOException;
 import java.net.InetAddress;
@@ -29,7 +29,6 @@ import org.apache.coyote.http11.filters.
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.ExceptionUtils;
-import org.apache.tomcat.util.buf.HexUtils;
 import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState;
 import org.apache.tomcat.util.net.NioChannel;
 import org.apache.tomcat.util.net.NioEndpoint;
@@ -46,7 +45,7 @@ import org.apache.tomcat.util.net.Socket
  * @author Remy Maucherat
  * @author Filip Hanik
  */
-public class Http11NioProcessor extends AbstractHttp11Processor {
+public class Http11NioProcessor extends AbstractHttp11Processor<NioChannel> {
 
     private static final Log log = LogFactory.getLog(Http11NioProcessor.class);
     @Override
@@ -75,9 +74,6 @@ public class Http11NioProcessor extends 
         response.setOutputBuffer(outputBuffer);
 
         initializeFilters(maxTrailerSize);
-
-        // Cause loading of HexUtils
-        HexUtils.load();
     }
 
 
@@ -100,11 +96,6 @@ public class Http11NioProcessor extends 
     protected NioEndpoint.SendfileData sendfileData = null;
 
     /**
-     * Comet used.
-     */
-    protected boolean comet = false;
-    
-    /**
      * Closed flag, a Comet async thread can 
      * signal for this Nio processor to be closed and recycled instead
      * of waiting for a timeout.
@@ -127,6 +118,7 @@ public class Http11NioProcessor extends 
      *
      * @throws IOException error during an I/O operation
      */
+    @Override
     public SocketState event(SocketStatus status)
         throws IOException {
 
@@ -177,74 +169,32 @@ public class Http11NioProcessor extends 
         }
     }
     
-    
-    /**
-     * Process pipelined HTTP requests using the specified input and output
-     * streams.
-     *
-     * @throws IOException error during an I/O operation
-     */
-    public SocketState asyncDispatch(SocketStatus status)
-        throws IOException {
-
-        long soTimeout = endpoint.getSoTimeout();
-        int keepAliveTimeout = endpoint.getKeepAliveTimeout();
 
-        RequestInfo rp = request.getRequestProcessor();
+    @Override
+    protected void resetTimeouts() {
         final NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
-        try {
-            rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
-            error = !adapter.asyncDispatch(request, response, status);
-            if ( !error ) {
-                if (attach != null) {
-                    attach.setComet(comet);
-                    if (comet) {
-                        Integer comettimeout = (Integer) request.getAttribute("org.apache.tomcat.comet.timeout");
-                        if (comettimeout != null) attach.setTimeout(comettimeout.longValue());
-                    } else {
-                        if (asyncStateMachine.isAsyncDispatching()) {
-                            //reset the timeout
-                            if (keepAlive && keepAliveTimeout>0) {
-                                attach.setTimeout(keepAliveTimeout);
-                            } else {
-                                attach.setTimeout(soTimeout);
-                            }
-                        }
-                    }
-
-                }
-            }
-        } catch (InterruptedIOException e) {
-            error = true;
-        } catch (Throwable t) {
-            ExceptionUtils.handleThrowable(t);
-            log.error(sm.getString("http11processor.request.process"), t);
-            error = true;
-        } finally {
-            if (error) {
-                // 500 - Internal Server Error
-                response.setStatus(500);
-                adapter.log(request, response, 0);
+        if (!error && attach != null &&
+                asyncStateMachine.isAsyncDispatching()) {
+            long soTimeout = endpoint.getSoTimeout();
+            int keepAliveTimeout = endpoint.getKeepAliveTimeout();
+
+            //reset the timeout
+            if (keepAlive && keepAliveTimeout>0) {
+                attach.setTimeout(keepAliveTimeout);
+            } else {
+                attach.setTimeout(soTimeout);
             }
         }
-
-        rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
-
-        if (error) {
-            return SocketState.CLOSED;
-        } else if (!comet && !isAsync()) {
-            return (keepAlive)?SocketState.OPEN:SocketState.CLOSED;
-        } else {
-            return SocketState.LONG;
-        }
     }
 
+
     /**
      * Process pipelined HTTP requests using the specified input and output
      * streams.
      *
      * @throws IOException error during an I/O operation
      */
+    @Override
     public SocketState process(SocketWrapper<NioChannel> socket)
         throws IOException {
         RequestInfo rp = request.getRequestProcessor();
@@ -453,12 +403,6 @@ public class Http11NioProcessor extends 
         socket = null;
         cometClose = false;
         comet = false;
-        remoteAddr = null;
-        remoteHost = null;
-        localAddr = null;
-        localName = null;
-        remotePort = -1;
-        localPort = -1;
         sendfileData = null;
     }
 

Modified: geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11NioProtocol.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=1145039&r1=1145038&r2=1145039&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11NioProtocol.java (original)
+++ geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11NioProtocol.java Mon Jul 11 06:29:23 2011
@@ -14,18 +14,15 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.coyote.http11;
 
 import java.nio.channels.SelectionKey;
 import java.nio.channels.SocketChannel;
 import java.util.Iterator;
-import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.coyote.AbstractProtocol;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
-import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.net.AbstractEndpoint;
 import org.apache.tomcat.util.net.NioChannel;
 import org.apache.tomcat.util.net.NioEndpoint;
@@ -33,7 +30,6 @@ import org.apache.tomcat.util.net.NioEnd
 import org.apache.tomcat.util.net.NioEndpoint.KeyAttachment;
 import org.apache.tomcat.util.net.SSLImplementation;
 import org.apache.tomcat.util.net.SecureNioChannel;
-import org.apache.tomcat.util.net.SocketStatus;
 import org.apache.tomcat.util.net.SocketWrapper;
 
 
@@ -152,16 +148,11 @@ public class Http11NioProtocol extends A
     // --------------------  Connection handler --------------------
 
     protected static class Http11ConnectionHandler
-            extends AbstractConnectionHandler implements Handler {
+            extends AbstractConnectionHandler<NioChannel,Http11NioProcessor>
+            implements Handler {
 
         protected Http11NioProtocol proto;
 
-        protected ConcurrentHashMap<SocketWrapper<NioChannel>, Http11NioProcessor> connections =
-            new ConcurrentHashMap<SocketWrapper<NioChannel>, Http11NioProcessor>();
-
-        protected RecycledProcessors<Http11NioProcessor> recycledProcessors =
-            new RecycledProcessors<Http11NioProcessor>(this);
-
         Http11ConnectionHandler(Http11NioProtocol proto) {
             this.proto = proto;
         }
@@ -182,20 +173,19 @@ public class Http11NioProtocol extends A
             return proto.sslImplementation;
         }
 
-        @Override
-        public void recycle() {
-            recycledProcessors.clear();
-        }
-        
+        /**
+         * Expected to be used by the Poller to release resources on socket
+         * close, errors etc.
+         */
         @Override
         public void release(SocketChannel socket) {
             if (log.isDebugEnabled()) 
                 log.debug("Iterating through our connections to release a socket channel:"+socket);
             boolean released = false;
-            Iterator<java.util.Map.Entry<SocketWrapper<NioChannel>, Http11NioProcessor>> it = connections.entrySet().iterator();
+            Iterator<java.util.Map.Entry<NioChannel, Http11NioProcessor>> it = connections.entrySet().iterator();
             while (it.hasNext()) {
-                java.util.Map.Entry<SocketWrapper<NioChannel>, Http11NioProcessor> entry = it.next();
-                if (entry.getKey().getSocket().getIOChannel()==socket) {
+                java.util.Map.Entry<NioChannel, Http11NioProcessor> entry = it.next();
+                if (entry.getKey().getIOChannel()==socket) {
                     it.remove();
                     Http11NioProcessor result = entry.getValue();
                     result.recycle();
@@ -209,8 +199,8 @@ public class Http11NioProtocol extends A
         }
         
         /**
-         * Use this only if the processor is not available, otherwise use
-         * {@link #release(SocketWrapper, Http11NioProcessor)}.
+         * Expected to be used by the Poller to release resources on socket
+         * close, errors etc.
          */
         @Override
         public void release(SocketWrapper<NioChannel> socket) {
@@ -222,107 +212,64 @@ public class Http11NioProtocol extends A
         }
 
 
+        /**
+         * Expected to be used by the handler once the processor is no longer
+         * required.
+         * 
+         * @param socket
+         * @param processor
+         * @param isSocketClosing   Not used in HTTP
+         * @param addToPoller
+         */
+        @Override
         public void release(SocketWrapper<NioChannel> socket,
-                Http11NioProcessor processor) {
-            connections.remove(socket);
+                Http11NioProcessor processor, boolean isSocketClosing,
+                boolean addToPoller) {
             processor.recycle();
             recycledProcessors.offer(processor);
+            if (addToPoller) {
+                socket.getSocket().getPoller().add(socket.getSocket());
+            }
         }
 
 
         @Override
-        public SocketState process(SocketWrapper<NioChannel> socket,
-                SocketStatus status) {
-            Http11NioProcessor processor = connections.remove(socket);
-
-            socket.setAsync(false); //no longer check for timeout
-
-            try {
-                if (processor == null) {
-                    processor = recycledProcessors.poll();
-                }
-                if (processor == null) {
-                    processor = createProcessor();
-                }
-
-                if (proto.isSSLEnabled() &&
-                        (proto.sslImplementation != null)
-                        && (socket.getSocket() instanceof SecureNioChannel)) {
-                    SecureNioChannel ch = (SecureNioChannel)socket.getSocket();
-                    processor.setSslSupport(
-                            proto.sslImplementation.getSSLSupport(
-                                    ch.getSslEngine().getSession()));
-                } else {
-                    processor.setSslSupport(null);
-                }
+        protected void initSsl(SocketWrapper<NioChannel> socket,
+                Http11NioProcessor processor) {
+            if (proto.isSSLEnabled() &&
+                    (proto.sslImplementation != null)
+                    && (socket.getSocket() instanceof SecureNioChannel)) {
+                SecureNioChannel ch = (SecureNioChannel)socket.getSocket();
+                processor.setSslSupport(
+                        proto.sslImplementation.getSSLSupport(
+                                ch.getSslEngine().getSession()));
+            } else {
+                processor.setSslSupport(null);
+            }
 
-                SocketState state = SocketState.CLOSED;
-                do {
-                    if (processor.isAsync() || state == SocketState.ASYNC_END) {
-                        state = processor.asyncDispatch(status);
-                    } else if (processor.comet) {
-                        state = processor.event(status);
-                    } else {
-                        state = processor.process(socket);
-                    }
-
-                    if (state != SocketState.CLOSED && processor.isAsync()) {
-                        state = processor.asyncPostProcess();
-                    }
-                } while (state == SocketState.ASYNC_END);
-
-                if (state == SocketState.LONG) {
-                    // In the middle of processing a request/response. Keep the
-                    // socket associated with the processor.
-                    connections.put(socket, processor);
-                    
-                    if (processor.isAsync()) {
-                        socket.setAsync(true);
-                    } else {
-                        // Either:
-                        //  - this is comet request
-                        //  - the request line/headers have not been completely
-                        //    read
-                        SelectionKey key = socket.getSocket().getIOChannel().keyFor(
-                                socket.getSocket().getPoller().getSelector());
-                        key.interestOps(SelectionKey.OP_READ);
-                        ((KeyAttachment) socket).interestOps(
-                                SelectionKey.OP_READ);
-                    }
-                } else if (state == SocketState.OPEN){
-                    // In keep-alive but between requests. OK to recycle
-                    // processor. Continue to poll for the next request.
-                    release(socket, processor);
-                    socket.getSocket().getPoller().add(socket.getSocket());
-                } else {
-                    // Connection closed. OK to recycle the processor.
-                    release(socket, processor);
-                }
-                return state;
+        }
 
-            } catch (java.net.SocketException e) {
-                // SocketExceptions are normal
-                log.debug(sm.getString(
-                        "http11protocol.proto.socketexception.debug"), e);
-            } catch (java.io.IOException e) {
-                // IOExceptions are normal
-                log.debug(sm.getString(
-                        "http11protocol.proto.ioexception.debug"), e);
-            }
-            // Future developers: if you discover any other
-            // rare-but-nonfatal exceptions, catch them here, and log as
-            // above.
-            catch (Throwable e) {
-                ExceptionUtils.handleThrowable(e);
-                // any other exception or error is odd. Here we log it
-                // with "ERROR" level, so it will show up even on
-                // less-than-verbose logs.
-                log.error(sm.getString("http11protocol.proto.error"), e);
+        @Override
+        protected void longPoll(SocketWrapper<NioChannel> socket,
+                Http11NioProcessor processor) {
+            connections.put(socket.getSocket(), processor);
+            
+            if (processor.isAsync()) {
+                socket.setAsync(true);
+            } else {
+                // Either:
+                //  - this is comet request
+                //  - the request line/headers have not been completely
+                //    read
+                SelectionKey key = socket.getSocket().getIOChannel().keyFor(
+                        socket.getSocket().getPoller().getSelector());
+                key.interestOps(SelectionKey.OP_READ);
+                ((KeyAttachment) socket).interestOps(
+                        SelectionKey.OP_READ);
             }
-            release(socket, processor);
-            return SocketState.CLOSED;
         }
 
+        @Override
         public Http11NioProcessor createProcessor() {
             Http11NioProcessor processor = new Http11NioProcessor(
                     proto.getMaxHttpHeaderSize(), (NioEndpoint)proto.endpoint,

Modified: geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11Processor.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11Processor.java?rev=1145039&r1=1145038&r2=1145039&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11Processor.java (original)
+++ geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11Processor.java Mon Jul 11 06:29:23 2011
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.coyote.http11;
 
 import java.io.EOFException;
@@ -29,7 +28,6 @@ import org.apache.coyote.http11.filters.
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.ExceptionUtils;
-import org.apache.tomcat.util.buf.HexUtils;
 import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState;
 import org.apache.tomcat.util.net.JIoEndpoint;
 import org.apache.tomcat.util.net.SSLSupport;
@@ -43,7 +41,7 @@ import org.apache.tomcat.util.net.Socket
  * @author Remy Maucherat
  * @author fhanik
  */
-public class Http11Processor extends AbstractHttp11Processor {
+public class Http11Processor extends AbstractHttp11Processor<Socket> {
 
     private static final Log log = LogFactory.getLog(Http11Processor.class);
     @Override
@@ -66,10 +64,6 @@ public class Http11Processor extends Abs
         response.setOutputBuffer(outputBuffer);
 
         initializeFilters(maxTrailerSize);
-
-        // Cause loading of HexUtils
-        HexUtils.load();
-
     }
 
 
@@ -135,19 +129,12 @@ public class Http11Processor extends Abs
      *  
      * @throws IOException error during an I/O operation
      */
+    @Override
     public SocketState process(SocketWrapper<Socket> socketWrapper)
         throws IOException {
         RequestInfo rp = request.getRequestProcessor();
         rp.setStage(org.apache.coyote.Constants.STAGE_PARSE);
 
-        // Set the remote address
-        remoteAddr = null;
-        remoteHost = null;
-        localAddr = null;
-        localName = null;
-        remotePort = -1;
-        localPort = -1;
-
         // Setting up the I/O
         this.socket = socketWrapper;
         inputBuffer.setInputStream(socket.getSocket().getInputStream());
@@ -370,12 +357,10 @@ public class Http11Processor extends Abs
 
         rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
         if (error || endpoint.isPaused()) {
-            recycle();
             return SocketState.CLOSED;
         } else if (isAsync()) {
             return SocketState.LONG;
         } else {
-            recycle();
             if (!keepAlive) {
                 return SocketState.CLOSED;
             } else {
@@ -385,42 +370,12 @@ public class Http11Processor extends Abs
     }
     
     
-    public SocketState asyncDispatch(SocketStatus status) {
-
-        RequestInfo rp = request.getRequestProcessor();
-        try {
-            rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
-            error = !adapter.asyncDispatch(request, response, status);
-        } catch (InterruptedIOException e) {
-            error = true;
-        } catch (Throwable t) {
-            ExceptionUtils.handleThrowable(t);
-            log.error(sm.getString("http11processor.request.process"), t);
-            error = true;
-        } finally {
-            if (error) {
-                // 500 - Internal Server Error
-                response.setStatus(500);
-                adapter.log(request, response, 0);
-            }
-        }
-
-        rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
-
-        if (error) {
-            return SocketState.CLOSED;
-        } else if (isAsync()) {
-            return SocketState.LONG;
-        } else {
-            if (!keepAlive) {
-                return SocketState.CLOSED;
-            } else {
-                return SocketState.OPEN;
-            }
-        }
+    @Override
+    protected void resetTimeouts() {
+        // NOOP for APR
     }
 
-    
+
     @Override
     protected void recycleInternal() {
         // Recycle
@@ -430,6 +385,13 @@ public class Http11Processor extends Abs
     }
 
 
+    @Override
+    public SocketState event(SocketStatus status) throws IOException {
+        // Should never reach this code but in case we do...
+        throw new IOException(
+                sm.getString("http11processor.comet.notsupported"));
+    }
+
     // ----------------------------------------------------- ActionHook Methods
 
 

Modified: geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11Protocol.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11Protocol.java?rev=1145039&r1=1145038&r2=1145039&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11Protocol.java (original)
+++ geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/coyote/http11/Http11Protocol.java Mon Jul 11 06:29:23 2011
@@ -14,20 +14,16 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.coyote.http11;
 
 import java.net.Socket;
-import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.coyote.AbstractProtocol;
 import org.apache.juli.logging.Log;
-import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.net.AbstractEndpoint;
 import org.apache.tomcat.util.net.JIoEndpoint;
 import org.apache.tomcat.util.net.JIoEndpoint.Handler;
 import org.apache.tomcat.util.net.SSLImplementation;
-import org.apache.tomcat.util.net.SocketStatus;
 import org.apache.tomcat.util.net.SocketWrapper;
 
 
@@ -101,16 +97,10 @@ public class Http11Protocol extends Abst
     // -----------------------------------  Http11ConnectionHandler Inner Class
 
     protected static class Http11ConnectionHandler
-            extends AbstractConnectionHandler implements Handler {
+            extends AbstractConnectionHandler<Socket, Http11Processor> implements Handler {
 
         protected Http11Protocol proto;
             
-        protected ConcurrentHashMap<SocketWrapper<Socket>, Http11Processor> connections =
-            new ConcurrentHashMap<SocketWrapper<Socket>, Http11Processor>();
-
-        protected RecycledProcessors<Http11Processor> recycledProcessors =
-            new RecycledProcessors<Http11Processor>(this);
-
         Http11ConnectionHandler(Http11Protocol proto) {
             this.proto = proto;
         }
@@ -130,76 +120,43 @@ public class Http11Protocol extends Abst
             return proto.sslImplementation;
         }
 
+        /**
+         * Expected to be used by the handler once the processor is no longer
+         * required.
+         * 
+         * @param socket            Not used in BIO
+         * @param processor
+         * @param isSocketClosing   Not used in HTTP
+         * @param addToPoller       Not used in BIO
+         */
         @Override
-        public void recycle() {
-            recycledProcessors.clear();
+        public void release(SocketWrapper<Socket> socket,
+                Http11Processor processor, boolean isSocketClosing,
+                boolean addToPoller) {
+            processor.recycle();
+            recycledProcessors.offer(processor);
         }
 
         @Override
-        public SocketState process(SocketWrapper<Socket> socket, SocketStatus status) {
-            Http11Processor processor = connections.remove(socket);
-            try {
-                if (processor == null) {
-                    processor = recycledProcessors.poll();
-                }
-                if (processor == null) {
-                    processor = createProcessor();
-                }
-
-                if (proto.isSSLEnabled() && (proto.sslImplementation != null)) {
-                    processor.setSSLSupport(
-                            proto.sslImplementation.getSSLSupport(
-                                    socket.getSocket()));
-                } else {
-                    processor.setSSLSupport(null);
-                }
-                
-                SocketState state = SocketState.CLOSED;
-                do {
-                    if (processor.isAsync() || state == SocketState.ASYNC_END) {
-                        state = processor.asyncDispatch(status);
-                    } else {
-                        state = processor.process(socket);
-                    }
-    
-                    if (state != SocketState.CLOSED && processor.isAsync()) {
-                        state = processor.asyncPostProcess();
-                    }
-                } while (state == SocketState.ASYNC_END);
-                // TODO Better to add a new state to the AsyncStateMachine and
-                //      remove ASYNC_END entirely
-
-                if (state == SocketState.LONG) {
-                    connections.put(socket, processor);
-                } else {
-                    processor.recycle();
-                    recycledProcessors.offer(processor);
-                }
-                return state;
-            } catch(java.net.SocketException e) {
-                // SocketExceptions are normal
-                log.debug(sm.getString(
-                        "http11protocol.proto.socketexception.debug"), e);
-            } catch (java.io.IOException e) {
-                // IOExceptions are normal
-                log.debug(sm.getString(
-                        "http11protocol.proto.ioexception.debug"), e);
+        protected void initSsl(SocketWrapper<Socket> socket,
+                Http11Processor processor) {
+            if (proto.isSSLEnabled() && (proto.sslImplementation != null)) {
+                processor.setSSLSupport(
+                        proto.sslImplementation.getSSLSupport(
+                                socket.getSocket()));
+            } else {
+                processor.setSSLSupport(null);
             }
-            // Future developers: if you discover any other
-            // rare-but-nonfatal exceptions, catch them here, and log as
-            // above.
-            catch (Throwable e) {
-                ExceptionUtils.handleThrowable(e);
-                // any other exception or error is odd. Here we log it
-                // with "ERROR" level, so it will show up even on
-                // less-than-verbose logs.
-                log.error(sm.getString("http11protocol.proto.error"), e);
-            }
-            processor.recycle();
-            recycledProcessors.offer(processor);
-            return SocketState.CLOSED;
+
         }
-        
+
+        @Override
+        protected void longPoll(SocketWrapper<Socket> socket,
+                Http11Processor processor) {
+            connections.put(socket.getSocket(), processor);
+        }
+
+        @Override
         protected Http11Processor createProcessor() {
             Http11Processor processor = new Http11Processor(
                     proto.getMaxHttpHeaderSize(), (JIoEndpoint)proto.endpoint,

Modified: geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/tomcat/util/net/AbstractEndpoint.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/tomcat/util/net/AbstractEndpoint.java?rev=1145039&r1=1145038&r2=1145039&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/tomcat/util/net/AbstractEndpoint.java (original)
+++ geronimo/external/trunk/tomcat-parent-7.0.18/catalina/src/main/java/org/apache/tomcat/util/net/AbstractEndpoint.java Mon Jul 11 06:29:23 2011
@@ -52,6 +52,8 @@ public abstract class AbstractEndpoint {
          * Different types of socket states to react upon.
          */
         public enum SocketState {
+            // TODO Add a new state to the AsyncStateMachine and remove
+            //      ASYNC_END (if possible)
             OPEN, CLOSED, LONG, ASYNC_END
         }
         

Modified: geronimo/external/trunk/tomcat-parent-7.0.18/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.18/pom.xml?rev=1145039&r1=1145038&r2=1145039&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.18/pom.xml (original)
+++ geronimo/external/trunk/tomcat-parent-7.0.18/pom.xml Mon Jul 11 06:29:23 2011
@@ -21,7 +21,7 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.geronimo.genesis</groupId>
-        <artifactId>genesis-java5-flava</artifactId>
+        <artifactId>genesis-java6-flava</artifactId>
         <version>2.0</version>
     </parent>
 

Added: geronimo/external/trunk/tomcat-parent-7.0.18/util/src/main/java/org/apache/tomcat/util/modeler/mbeans-descriptors.dtd
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.18/util/src/main/java/org/apache/tomcat/util/modeler/mbeans-descriptors.dtd?rev=1145039&view=auto
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.18/util/src/main/java/org/apache/tomcat/util/modeler/mbeans-descriptors.dtd (added)
+++ geronimo/external/trunk/tomcat-parent-7.0.18/util/src/main/java/org/apache/tomcat/util/modeler/mbeans-descriptors.dtd Mon Jul 11 06:29:23 2011
@@ -0,0 +1,249 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+
+<!--
+     DTD for the Model MBeans Configuration File
+
+     To support validation of your configuration file, include the following
+     DOCTYPE element at the beginning (after the "xml" declaration):
+
+     <!DOCTYPE mbeans-descriptors PUBLIC
+      "-//Apache Software Foundation//DTD Model MBeans Configuration File"
+      "http://jakarta.apache.org/commons/dtds/mbeans-descriptors.dtd">
+
+     $Id: mbeans-descriptors.dtd 615583 2008-01-27 12:01:49Z rjung $
+-->
+
+
+<!-- ========== Defined Types ============================================= -->
+
+
+<!-- A "Boolean" is the string representation of a boolean (true or false)
+     variable.
+-->
+<!ENTITY % Boolean "(true|false|yes|no)">
+
+
+<!-- A "ClassName" is the fully qualified name of a Java class that is
+     instantiated to provide the functionality of the enclosing element.
+-->
+<!ENTITY % ClassName "CDATA">
+
+
+<!-- A "MethodName" is the name of a constructor or method, which must
+     be legal according to the syntax requirements of the Java language.
+-->
+<!ENTITY % MethodName "CDATA">
+
+
+<!-- A "VariableName" is the name of a variable or parameter, which must
+     be legal according to the syntax requirements of the Java language.
+-->
+<!ENTITY % VariableName "CDATA">
+
+
+<!-- ========== Element Definitions ======================================= -->
+
+
+<!-- The "mbeans-descriptors" element is the root of the configuration file
+     hierarchy, and contains nested elements for all of the other
+     configuration settings.  Remaining element definitions are listed
+     in alphabetical order.
+-->
+<!ELEMENT mbeans-descriptors (mbean*)>
+<!ATTLIST mbeans-descriptors id          ID             #IMPLIED>
+
+
+<!-- The "attribute" element describes a JavaBeans property of an MBean.
+     The following attributes are supported:
+
+     description      Human-readable description of this attribute.
+
+     displayName      Display name of this attribute.
+
+     getMethod        Name of the property getter method, if it does
+                      not follow standard JavaBeans naming patterns.
+
+     is               Boolean value indicating whether or not this
+                      attribute is a boolean with an "is" getter method.
+                      By default, this is set to "false".
+
+     name             Name of this JavaBeans property, conforming to
+                      standard naming design patterns.
+
+     readable         Boolean value indicating whether or not this
+                      attribute is readable by management applications.
+                      By default, this is set to "true".
+
+     setMethod        Name of the property setter method, if it does
+                      not follow standard JavaBeans naming patterns.
+
+     type             Fully qualified Java class name of this attribute.
+
+     writeable        Boolean value indicating whether or not this
+                      attribute is writeable by management applications.
+                      By default, this is set to "true".
+-->
+<!ELEMENT attribute (descriptor?)>
+<!ATTLIST attribute         id           ID             #IMPLIED>
+<!ATTLIST attribute         description  CDATA          #IMPLIED>
+<!ATTLIST attribute         displayName  CDATA          #IMPLIED>
+<!ATTLIST attribute         getMethod    %MethodName;   #IMPLIED>
+<!ATTLIST attribute         is           %Boolean;      #IMPLIED>
+<!ATTLIST attribute         name         %VariableName; #IMPLIED>
+<!ATTLIST attribute         readable     %Boolean;      #IMPLIED>
+<!ATTLIST attribute         setMethod    %MethodName;   #IMPLIED>
+<!ATTLIST attribute         type         %ClassName;    #IMPLIED>
+<!ATTLIST attribute         writeable    %Boolean;      #IMPLIED>
+
+
+<!-- The "constructor" element describes a public constructor for the
+     underlying actual class.  It may contain nested "parameter" elements
+     for the various arguments to this constructor.  The following attributes
+     are supported:
+
+     displayName      Display name of this constructor.
+
+     name             Name of this constructor (by Java convention, this must
+                      be the same as the base class name).
+-->
+<!ELEMENT constructor (descriptor?, parameter*)>
+<!ATTLIST constructor       id           ID             #IMPLIED>
+<!ATTLIST constructor       displayName  CDATA          #IMPLIED>
+<!ATTLIST constructor       name         %VariableName; #IMPLIED>
+
+
+<!-- The "descriptor" element groups a set of descriptor fields whose
+     values will be included in the Descriptor for the corresponding
+     metatdata info classes.
+-->
+<!ELEMENT descriptor (field*)>
+<!ATTLIST descriptor        id           ID             #IMPLIED>
+
+
+<!-- The "field" element represents a single name/value pair that will
+     be included in the Descriptor corresponding to our enclosing
+     "descriptor" element.  The following attributes are supported:
+
+     name             Field name of the field to be included
+
+     value            Field value of the field to be included
+                      (will be stored as a String)
+-->
+<!ELEMENT field EMPTY>
+<!ATTLIST field             id           ID             #IMPLIED>
+<!ATTLIST field             name         CDATA          #REQUIRED>
+<!ATTLIST field             value        CDATA          #REQUIRED>
+
+
+
+<!-- The "mbean" element describes a particular JMX ModelMBean implementation,
+     including the information necessary to construct the corresponding
+     ModelMBeanInfo structures.  The following attributes are supported:
+
+     className        Fully qualified Java class name of the ModelMBean
+                      implementation class.  If not specified, the standard
+                      implementation provided by JMX will be utilized.
+
+     description      Human-readable description of this managed bean.
+
+     domain           The JMX MBeanServer domain in which the ModelMBean
+                      created by this managed bean should be registered,
+                      when creating its ObjectName.
+
+     group            Optional name of a "grouping classification" that can
+                      be used to select groups of similar MBean implementation
+                      classes.
+
+     name             Unique name of this MBean (normally corresponds to the
+                      base class name of the corresponding server component).
+
+     type             Fully qualified Java class name of the underlying
+                      managed resource implementation class.
+-->
+<!ELEMENT mbean (descriptor?, attribute*, constructor*, notification*, operation*)>
+<!ATTLIST mbean             id           ID             #IMPLIED>
+<!ATTLIST mbean             className    %ClassName;    #IMPLIED>
+<!ATTLIST mbean             description  CDATA          #IMPLIED>
+<!ATTLIST mbean             domain       CDATA          #IMPLIED>
+<!ATTLIST mbean             group        CDATA          #IMPLIED>
+<!ATTLIST mbean             name         %MethodName;   #IMPLIED>
+<!ATTLIST mbean             type         %ClassName;    #IMPLIED>
+
+
+<!-- The "notification" element describes the notification types that are
+     generated by a particular managed bean.  The following attributes
+     are supported:
+
+     description      Human-readable description of these notification events.
+
+     name             Name of this set of notification event types.
+-->
+<!ELEMENT notification (descriptor?, notification-type*)>
+<!ATTLIST notification      id           ID             #IMPLIED>
+<!ATTLIST notification      description  CDATA          #IMPLIED>
+<!ATTLIST notification      name         %VariableName; #IMPLIED>
+
+
+<!-- The nested content of the "notification-type" element is the event string
+     of an event that can be emitted by this MBean.
+-->
+<!ELEMENT notification-type (#PCDATA)>
+<!ATTLIST notification-type id           ID             #IMPLIED>
+
+
+<!-- The "operation" element describes a the signature of a public method
+     that is accessible to management applications.  The following attributes
+     are supported:
+
+     description      Human-readable description of this operation.
+
+     impact           Indication of the impact of this method:
+                      ACTION (write like), ACTION-INFO (write+read like)
+                      INFO (read like), or UNKNOWN.
+
+     name             Name of this public method.
+
+     returnType       Fully qualified Java class name of the return
+                      type of this method.
+-->
+<!ELEMENT operation   (descriptor?, parameter*)>
+<!ATTLIST operation         id           ID             #IMPLIED>
+<!ATTLIST operation         description  CDATA          #IMPLIED>
+<!ATTLIST operation         impact       CDATA          #IMPLIED>
+<!ATTLIST operation         name         %VariableName; #IMPLIED>
+<!ATTLIST operation         returnType   %ClassName;    #IMPLIED>
+
+
+<!-- The "parameter" element describes a single argument that will be passed
+     to a constructor or operation.  The following attributes are supported:
+
+     description      Human-readable description of this parameter.
+
+     name             Java language name of this parameter.
+
+     type             Fully qualified Java class name of this parameter.
+-->
+<!ELEMENT parameter EMPTY>
+<!ATTLIST parameter         id           ID             #IMPLIED>
+<!ATTLIST parameter         description  CDATA          #IMPLIED>
+<!ATTLIST parameter         name         %VariableName; #IMPLIED>
+<!ATTLIST parameter         type         %ClassName;    #IMPLIED>
+
+

Propchange: geronimo/external/trunk/tomcat-parent-7.0.18/util/src/main/java/org/apache/tomcat/util/modeler/mbeans-descriptors.dtd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/external/trunk/tomcat-parent-7.0.18/util/src/main/java/org/apache/tomcat/util/modeler/mbeans-descriptors.dtd
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/external/trunk/tomcat-parent-7.0.18/util/src/main/java/org/apache/tomcat/util/modeler/mbeans-descriptors.dtd
------------------------------------------------------------------------------
    svn:mime-type = text/plain