tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject svn commit: r543576 - /tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java
Date Fri, 01 Jun 2007 18:55:11 GMT
Author: fhanik
Date: Fri Jun  1 11:55:10 2007
New Revision: 543576

URL: http://svn.apache.org/viewvc?view=rev&rev=543576
Log:
added cleanup code

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

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java?view=diff&rev=543576&r1=543575&r2=543576
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java Fri Jun  1 11:55:10
2007
@@ -20,20 +20,20 @@
 import java.io.IOException;
 import java.net.SocketTimeoutException;
 import java.nio.ByteBuffer;
+import java.nio.channels.CancelledKeyException;
+import java.nio.channels.ClosedChannelException;
 import java.nio.channels.SelectionKey;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.tomcat.util.net.NioEndpoint.KeyAttachment;
-import org.apache.tomcat.util.MutableInteger;
 import java.nio.channels.Selector;
+import java.nio.channels.SocketChannel;
+import java.util.Iterator;
 import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
-import java.util.Iterator;
-import java.nio.channels.SocketChannel;
-import java.nio.channels.ClosedChannelException;
-import java.nio.channels.CancelledKeyException;
-import java.util.concurrent.CountDownLatch;
+import org.apache.tomcat.util.MutableInteger;
+import org.apache.tomcat.util.net.NioEndpoint.KeyAttachment;
 
 public class NioBlockingSelector {
     
@@ -61,6 +61,7 @@
         if (poller!=null) {
             poller.disable();
             poller.interrupt();
+            poller = null;
         }
     }
 
@@ -214,7 +215,12 @@
                             sk.interestOps(sk.interestOps() | ops);
                         }
                     }catch (ClosedChannelException cx) {
-                        if (sk!=null) sk.cancel();
+                        if (sk!=null) {
+                            sk.cancel();
+                            sk.attach(null);
+                            if (SelectionKey.OP_WRITE==(ops&SelectionKey.OP_WRITE)) countDown(key.getWriteLatch());
+                            if (SelectionKey.OP_READ==(ops&SelectionKey.OP_READ))countDown(key.getReadLatch());
+                        }
                     }
                 }
             };



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


Mime
View raw message