Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 87641 invoked from network); 1 Jun 2007 18:55:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Jun 2007 18:55:39 -0000 Received: (qmail 75627 invoked by uid 500); 1 Jun 2007 18:55:37 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 75586 invoked by uid 500); 1 Jun 2007 18:55:37 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 75575 invoked by uid 500); 1 Jun 2007 18:55:37 -0000 Delivered-To: apmail-jakarta-tomcat-dev@jakarta.apache.org Received: (qmail 75571 invoked by uid 99); 1 Jun 2007 18:55:37 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jun 2007 11:55:36 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jun 2007 11:55:31 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 8C4E61A981A; Fri, 1 Jun 2007 11:55:11 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r543576 - /tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java Date: Fri, 01 Jun 2007 18:55:11 -0000 To: tomcat-dev@jakarta.apache.org From: fhanik@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070601185511.8C4E61A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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