Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 74030 invoked from network); 7 Jul 2006 14:28:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Jul 2006 14:28:41 -0000 Received: (qmail 12305 invoked by uid 500); 7 Jul 2006 14:28:37 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 12264 invoked by uid 500); 7 Jul 2006 14:28: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 12252 invoked by uid 500); 7 Jul 2006 14:28:37 -0000 Delivered-To: apmail-jakarta-tomcat-dev@jakarta.apache.org Received: (qmail 12249 invoked by uid 99); 7 Jul 2006 14:28:37 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Jul 2006 07:28:37 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Jul 2006 07:28:36 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 1B2891A981A; Fri, 7 Jul 2006 07:28:10 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r419896 - in /tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport: AbstractSender.java nio/NioReceiver.java nio/NioReplicationThread.java nio/PooledParallelSender.java Date: Fri, 07 Jul 2006 14:28:09 -0000 To: tomcat-dev@jakarta.apache.org From: fhanik@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060707142810.1B2891A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: fhanik Date: Fri Jul 7 07:28:08 2006 New Revision: 419896 URL: http://svn.apache.org/viewvc?rev=419896&view=rev Log: Minor adjustments Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/AbstractSender.java tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReceiver.java tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReplicationThread.java tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/PooledParallelSender.java Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/AbstractSender.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/AbstractSender.java?rev=419896&r1=419895&r2=419896&view=diff ============================================================================== --- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/AbstractSender.java (original) +++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/AbstractSender.java Fri Jul 7 07:28:08 2006 @@ -113,11 +113,10 @@ */ public boolean keepalive() { boolean disconnect = false; - if ( keepAliveCount >= 0 && requestCount>keepAliveCount ) disconnect = true; - else if ( keepAliveTime >= 0 && keepAliveTime> (System.currentTimeMillis()-connectTime) ) disconnect = true; - if ( disconnect ) disconnect(); - return disconnect; - + if ( keepAliveCount >= 0 && requestCount>keepAliveCount ) disconnect = true; + else if ( keepAliveTime >= 0 && keepAliveTime> (System.currentTimeMillis()-connectTime) ) disconnect = true; + if ( disconnect ) disconnect(); + return disconnect; } protected void setConnected(boolean connected){ Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReceiver.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReceiver.java?rev=419896&r1=419895&r2=419896&view=diff ============================================================================== --- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReceiver.java (original) +++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReceiver.java Fri Jul 7 07:28:08 2006 @@ -160,14 +160,16 @@ } public static void cancelledKey(SelectionKey key) { - try { - key.cancel(); - key.channel().close(); - key.attach(null); - } catch (IOException e) { - if (log.isDebugEnabled()) log.debug("", e); - // Ignore + ObjectReader reader = (ObjectReader)key.attachment(); + if ( reader != null ) { + reader.setCancelled(true); + reader.finish(); } + key.cancel(); + key.attach(null); + try { ((SocketChannel)key.channel()).socket().close(); } catch (IOException e) { if (log.isDebugEnabled()) log.debug("", e); } + try { key.channel().close(); } catch (IOException e) { if (log.isDebugEnabled()) log.debug("", e); } + } protected void socketTimeouts() { @@ -193,6 +195,9 @@ long delta = now - ka.getLastAccess(); if (delta > (long) getTimeout() && (!ka.isAccessed())) { log.warn("Channel key is registered, but has had no interest ops for the last "+getTimeout()+" ms. (cancelled:"+ka.isCancelled()+")"); +// System.out.println("Interest:"+key.interestOps()); +// System.out.println("Ready Ops:"+key.readyOps()); +// System.out.println("Valid:"+key.isValid()); ka.setLastAccess(now); //key.interestOps(SelectionKey.OP_READ); }//end if Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReplicationThread.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReplicationThread.java?rev=419896&r1=419895&r2=419896&view=diff ============================================================================== --- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReplicationThread.java (original) +++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReplicationThread.java Fri Jul 7 07:28:08 2006 @@ -77,11 +77,13 @@ if (key == null) { continue; // just in case } - ObjectReader reader = (ObjectReader)key.attachment(); try { - reader.setLastAccess(System.currentTimeMillis()); - reader.access(); - drainChannel (key,reader); + ObjectReader reader = (ObjectReader)key.attachment(); + if ( reader == null ) { + cancelKey(key); + } else { + drainChannel(key, reader); + } } catch (Exception e) { //this is common, since the sockets on the other //end expire after a certain time. @@ -97,7 +99,7 @@ } cancelKey(key); } finally { - reader.finish(); + } key = null; // done, ready for more, return to pool @@ -132,6 +134,8 @@ * so the selector will resume watching this channel. */ protected void drainChannel (final SelectionKey key, ObjectReader reader) throws Exception { + reader.setLastAccess(System.currentTimeMillis()); + reader.access(); SocketChannel channel = (SocketChannel) key.channel(); int count; buffer.clear(); // make buffer empty @@ -158,7 +162,7 @@ ChannelMessage[] msgs = pkgcnt == 0? ChannelData.EMPTY_DATA_ARRAY : reader.execute(); - registerForRead(key);//register to read new data, before we send it off to avoid dead locks + registerForRead(key,reader);//register to read new data, before we send it off to avoid dead locks for ( int i=0; i