tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkoli...@apache.org
Subject svn commit: r1173614 - /tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
Date Wed, 21 Sep 2011 13:14:29 GMT
Author: kkolinko
Date: Wed Sep 21 13:14:29 2011
New Revision: 1173614

URL: http://svn.apache.org/viewvc?rev=1173614&view=rev
Log:
Simplify code in NioEndpoint$Poller.
The events.size() call is costly, because it is a loop that counts entries in a linked queue.
Actually it is not needed here at all, because we iterate the queue by ourselves.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1173614&r1=1173613&r2=1173614&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Wed Sep 21 13:14:29 2011
@@ -970,13 +970,19 @@ public class NioEndpoint extends Abstrac
             else r.reset(socket,null,interestOps);
             addEvent(r);
         }
-        
+
+        /**
+         * Processes events in the event queue of the Poller.
+         * 
+         * @return <code>true</code> if some events were processed,
+         *   <code>false</code> if queue was empty
+         */
         public boolean events() {
             boolean result = false;
 
             Runnable r = null;
-            result = (events.size() > 0);
             while ( (r = events.poll()) != null ) {
+                result = true;
                 try {
                     r.run();
                     if ( r instanceof PollerEvent ) {



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


Mime
View raw message