Clean up. The setAsync can be done in a single bottleneck, instead mixed into the...
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 25 Mar 2010 19:32:46 +0000 (19:32 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 25 Mar 2010 19:32:46 +0000 (19:32 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@927555 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/connector/Request.java
java/org/apache/coyote/ajp/AjpProcessor.java
java/org/apache/coyote/ajp/AjpProtocol.java
java/org/apache/coyote/http11/Http11Processor.java
java/org/apache/coyote/http11/Http11Protocol.java
java/org/apache/tomcat/util/net/AbstractEndpoint.java
java/org/apache/tomcat/util/net/JIoEndpoint.java

index 36c15c3..62ad7eb 100644 (file)
@@ -1558,7 +1558,6 @@ public class Request
     }
 
     public AsyncContext getAsyncContext() {
-        // TODO SERVLET3 - async
         return this.asyncContext;
     }
 
index 55431a9..2bd43fc 100644 (file)
@@ -482,7 +482,6 @@ public class AjpProcessor implements ActionHook {
         }
         if (async && !error) {
             rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
-            socket.setAsync(true);
             return SocketState.LONG;
         } else {
             rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
@@ -513,7 +512,6 @@ public class AjpProcessor implements ActionHook {
 
         if (async) {
             if (error) {
-                socket.setAsync(false);
                 response.setStatus(500);
                 request.updateCounters();
                 recycle();
@@ -524,7 +522,6 @@ public class AjpProcessor implements ActionHook {
                 return SocketState.LONG;
             }
         } else {
-            socket.setAsync(false);
             if (error) {
                 response.setStatus(500);
             }
index ff64929..008a310 100644 (file)
@@ -385,8 +385,10 @@ public class AjpProtocol
                 SocketState state = socket.isAsync()?processor.asyncDispatch(status):processor.process(socket);
                 if (state == SocketState.LONG) {
                     connections.put(socket, processor);
+                    socket.setAsync(true);
                 } else {
                     connections.remove(socket);
+                    socket.setAsync(false);
                 }
                 return state;
             } catch(java.net.SocketException e) {
index bdd0852..2e8f801 100644 (file)
@@ -323,11 +323,9 @@ public class Http11Processor extends AbstractHttp11Processor implements ActionHo
                 recycle();
                 return SocketState.CLOSED;
             } else {
-                socket.setAsync(true);
                 return SocketState.LONG;
             }
         } else {
-            socket.setAsync(false);
             if ( error || (!keepAlive)) {
                 recycle();
                 return SocketState.CLOSED;
@@ -357,14 +355,12 @@ public class Http11Processor extends AbstractHttp11Processor implements ActionHo
 
         if (async) {
             if (error) {
-                socket.setAsync(false);
                 recycle();
                 return SocketState.CLOSED;
             } else {
                 return SocketState.LONG;
             }
         } else {
-            socket.setAsync(false);
             if ( error || (!keepAlive)) {
                 recycle();
                 return SocketState.CLOSED;
index a82ccc2..399079e 100644 (file)
@@ -261,8 +261,10 @@ public class Http11Protocol extends AbstractHttp11Protocol {
                 SocketState state = socket.isAsync()?processor.asyncDispatch(status):processor.process(socket);
                 if (state == SocketState.LONG) {
                     connections.put(socket, processor);
+                    socket.setAsync(true);
                 } else {
                     connections.remove(socket);
+                    socket.setAsync(false);
                 }
                 return state;
             } catch(java.net.SocketException e) {
index a2f237a..6121e07 100644 (file)
@@ -146,12 +146,12 @@ public abstract class AbstractEndpoint {
         return socketProperties;
     }
 
-
-
-
     
     // ----------------------------------------------------------------- Properties
 
+    private int maxConnections = 10000;
+    public void setMaxConnections(int maxCon) { this.maxConnections = maxCon; }
+    public int  getMaxConnections() { return this.maxConnections; }
     /**
      * External Executor based thread pool.
      */
index ff7e864..3a87df9 100644 (file)
@@ -512,12 +512,4 @@ public class JIoEndpoint extends AbstractEndpoint {
 
     protected ConcurrentLinkedQueue<SocketWrapper> waitingRequests = new ConcurrentLinkedQueue<SocketWrapper>();
     
-    protected class RequestProcessor implements Runnable {
-
-        @Override
-        public void run() {
-            
-        }
-        
-    }
 }