Author: fhanik
Date: Mon Dec  8 07:52:23 2008
New Revision: 724384

URL: http://svn.apache.org/viewvc?rev=724384&view=rev
Log:
implement a bit cleanup and a rough estimate on the size of a poller

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=724384&r1=724383&r2=724384&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Mon Dec  8 
07:52:23 2008
@@ -1280,12 +1280,14 @@
         
         protected CountDownLatch stopLatch = new CountDownLatch(1);
 
-
+        protected volatile int keyCount = 0;
 
         public Poller() throws IOException {
             this.selector = Selector.open();
         }
         
+        public int getKeyCount() { return keyCount; }
+        
         public Selector getSelector() { return selector;}
 
         /**
@@ -1380,8 +1382,9 @@
                     //processSocket(ka.getChannel(), status, dispatch);
                     ka.setComet(false);//to avoid a loop
                     if (status == SocketStatus.TIMEOUT ) {
-                        processSocket(ka.getChannel(), status, true);
-                        return; // don't close on comet timeout
+                        if (processSocket(ka.getChannel(), status, true)) {
+                            return; // don't close on comet timeout
+                        }
                     } else {
                         processSocket(ka.getChannel(), status, false); //don't 
dispatch if the lines below are cancelling the key
                     }                    
@@ -1430,7 +1433,8 @@
                                 //do a non blocking select
                                 keyCount = selector.selectNow();
                             }else {
-                                wakeupCounter.set( -1);
+                                keyCount = selector.keys().size();
+                                wakeupCounter.set(-1);
                                 keyCount = selector.select(selectorTimeout);
                             }
                             wakeupCounter.set(0);



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to