added in notes to myself about blocking the poller thread, that should be prohibited
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 21 Feb 2007 03:47:05 +0000 (03:47 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 21 Feb 2007 03:47:05 +0000 (03:47 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@509880 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/net/NioBlockingSelector.java
java/org/apache/tomcat/util/net/NioEndpoint.java

index e046caa..b9519cb 100644 (file)
@@ -68,6 +68,7 @@ public class NioBlockingSelector {
                     att.startLatch(1);\r
                     socket.getPoller().add(socket,SelectionKey.OP_WRITE);\r
                     att.getLatch().await(writeTimeout,TimeUnit.MILLISECONDS);\r
+                    att.resetLatch();\r
                 }catch (InterruptedException ignore) {\r
                 }\r
                 if ( att.getLatch() == null ) keycount = 1;\r
@@ -124,6 +125,7 @@ public class NioBlockingSelector {
                     att.startLatch(1);\r
                     socket.getPoller().add(socket,SelectionKey.OP_READ);\r
                     att.getLatch().await(readTimeout,TimeUnit.MILLISECONDS);\r
+                    att.resetLatch();\r
                 }catch (InterruptedException ignore) {\r
                 }\r
                 if ( att.getLatch() == null ) keycount = 1;\r
index f6f51c5..c40b29c 100644 (file)
@@ -876,7 +876,6 @@ public class NioEndpoint {
                 }
             }
         }
-
     }
 
 
@@ -1270,8 +1269,10 @@ public class NioEndpoint {
                                         processSocket(channel, SocketStatus.DISCONNECT);
                                 } else if ( attachment.getLatch() != null ) {
                                     attachment.getLatch().countDown();
-                                    attachment.resetLatch();
                                 } else {
+                                    //this sucker here dead locks with the count down latch
+                                    //since this call is blocking if no threads are available.
+                                    //TODO: FIXME BIG TIME
                                     boolean close = (!processSocket(channel));
                                     if ( close ) {
                                         channel.close();