Author: fhanik
Date: Fri Jun  8 03:52:49 2007
New Revision: 545474

URL: http://svn.apache.org/viewvc?view=rev&rev=545474
Log:
Cancel the blocking key only, no need to cancel anything else here

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=545474&r1=545473&r2=545474
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java Fri 
Jun  8 03:52:49 2007
@@ -122,7 +122,7 @@
         } finally {
             poller.remove(att,SelectionKey.OP_WRITE);
             if (timedout && key != null) {
-                cancelKey(socket, key);
+                poller.cancelKey(socket, key);
             }
         }
         return written;
@@ -182,26 +182,29 @@
         } finally {
             poller.remove(att,SelectionKey.OP_READ);
             if (timedout && key != null) {
-                cancelKey(socket,key);
+                poller.cancelKey(socket,key);
             }
         }
         return read;
     }
 
-    private static void cancelKey(final NioChannel socket, final SelectionKey 
key) {
-        socket.getPoller().addEvent(
-            new Runnable() {
-            public void run() {
-                socket.getPoller().cancelledKey(key,SocketStatus.ERROR,false);
-            }
-        });
-    }
     
     protected class BlockPoller extends Thread {
         protected boolean run = true;
         protected Selector selector = null;
         protected ConcurrentLinkedQueue events = new ConcurrentLinkedQueue();
         public void disable() { run = false; selector.wakeup();}
+
+        public void cancelKey(final NioChannel socket, final SelectionKey key) 
{
+            Runnable r = new Runnable() {
+                public void run() {
+                    key.cancel();
+                }
+            };
+            events.offer(r);
+            selector.wakeup();
+        }
+
         
         public void add(final KeyAttachment key, final int ops) {
             Runnable r = new Runnable() {



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

Reply via email to