Author: markt
Date: Fri Feb 12 15:00:44 2016
New Revision: 1730034

URL: http://svn.apache.org/viewvc?rev=1730034&view=rev
Log:
Performance optimisation.
For a very simple servlet this reduces processing time by ~1%.

Modified:
    tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java

Modified: tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java?rev=1730034&r1=1730033&r2=1730034&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java [UTF-8] 
(original)
+++ tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java [UTF-8] Fri Feb 
12 15:00:44 2016
@@ -411,11 +411,18 @@ public class AsyncStateMachine {
 
 
     public synchronized void recycle() {
+        // Use lastAsyncStart to determine if this instance has been used since
+        // it was last recycled. If it hasn't there is no need to recycle again
+        // which saves the relatively expensive call to notifyAll()
+        if (lastAsyncStart == 0) {
+            return;
+        }
         // Ensure in case of error that any non-container threads that have 
been
         // paused are unpaused.
         notifyAll();
         asyncCtxt = null;
         state = AsyncState.DISPATCHED;
+        lastAsyncStart = 0;
     }
 
 



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

Reply via email to