Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@www.apache.org Received: (qmail 12671 invoked from network); 9 Jan 2004 02:51:03 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 9 Jan 2004 02:51:03 -0000 Received: (qmail 59899 invoked by uid 500); 9 Jan 2004 02:50:38 -0000 Delivered-To: apmail-jakarta-tomcat-dev-archive@jakarta.apache.org Received: (qmail 59847 invoked by uid 500); 9 Jan 2004 02:50:38 -0000 Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Developers List" Reply-To: "Tomcat Developers List" Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 59834 invoked by uid 500); 9 Jan 2004 02:50:38 -0000 Received: (qmail 59831 invoked from network); 9 Jan 2004 02:50:38 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 9 Jan 2004 02:50:38 -0000 Received: (qmail 12597 invoked by uid 1602); 9 Jan 2004 02:50:55 -0000 Date: 9 Jan 2004 02:50:55 -0000 Message-ID: <20040109025055.12596.qmail@minotaur.apache.org> From: fhanik@apache.org To: jakarta-tomcat-catalina-cvs@apache.org Subject: cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp ReplicationListener.java SimpleTcpCluster.java TcpReplicationThread.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N fhanik 2004/01/08 18:50:54 Modified: modules/cluster/src/share/org/apache/catalina/cluster/mcast McastService.java modules/cluster/src/share/org/apache/catalina/cluster/tcp ReplicationListener.java SimpleTcpCluster.java TcpReplicationThread.java Log: fixed 100% cpu bug with the replication listener. We don't want to listen to OP_WRITE events at all. Added a bind address to the broadcast address Revision Changes Path 1.5 +9 -5 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/mcast/McastService.java Index: McastService.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/mcast/McastService.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- McastService.java 18 Dec 2003 04:20:14 -0000 1.4 +++ McastService.java 9 Jan 2004 02:50:54 -0000 1.5 @@ -166,10 +166,14 @@ int port = Integer.parseInt(getProperties().getProperty("tcpListenPort")); String name = "tcp://"+host+":"+port; localMember = new McastMember(name,host,port,100); + java.net.InetAddress bind = null; + if ( properties.getProperty("mcastBindAddress")!= null ) { + bind = java.net.InetAddress.getByName(properties.getProperty("mcastBindAddress")); + } impl = new McastServiceImpl((McastMember)localMember,Long.parseLong(properties.getProperty("msgFrequency")), Long.parseLong(properties.getProperty("memberDropTime")), Integer.parseInt(properties.getProperty("mcastPort")), - null, + bind, java.net.InetAddress.getByName(properties.getProperty("mcastAddress")), this); 1.8 +12 -5 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java Index: ReplicationListener.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- ReplicationListener.java 20 Dec 2003 00:48:52 -0000 1.7 +++ ReplicationListener.java 9 Jan 2004 02:50:54 -0000 1.8 @@ -144,7 +144,9 @@ // selected set contains keys of the ready channels try { + //System.out.println("Selecting with timeout="+timeout); int n = selector.select(timeout); + //System.out.println("select returned="+n); if (n == 0) { continue; // nothing to do } @@ -160,18 +162,23 @@ SocketChannel channel = server.accept(); registerChannel(selector, channel, - SelectionKey.OP_READ | - SelectionKey.OP_WRITE, + SelectionKey.OP_READ, new ObjectReader(channel, selector, callback)); } // is there data to read on this channel? + //System.out.println("key readable="+key.isReadable()); if (key.isReadable()) { readDataFromSocket(key); + } else { + //System.out.println("This shouldn't get called"); + key.interestOps(key.interestOps() & (~key.OP_WRITE)); } + // remove key from selected set, it's been handled it.remove(); } + System.out.println("Done with loop"); } catch (java.nio.channels.CancelledKeyException nx) { log.warn( 1.22 +9 -4 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java Index: SimpleTcpCluster.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- SimpleTcpCluster.java 18 Dec 2003 04:20:15 -0000 1.21 +++ SimpleTcpCluster.java 9 Jan 2004 02:50:54 -0000 1.22 @@ -611,6 +611,11 @@ svcproperties.setProperty("mcastAddress",addr); } + + public void setMcastBindAddress(String bindaddr) { + svcproperties.setProperty("mcastBindAddress",bindaddr); + } + public void setMcastPort(int port) { svcproperties.setProperty("mcastPort",String.valueOf(port)); } 1.6 +5 -4 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/TcpReplicationThread.java Index: TcpReplicationThread.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/TcpReplicationThread.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TcpReplicationThread.java 20 Dec 2003 00:48:52 -0000 1.5 +++ TcpReplicationThread.java 9 Jan 2004 02:50:54 -0000 1.6 @@ -145,6 +145,7 @@ this.key = key; this.synchronous=synchronous; key.interestOps (key.interestOps() & (~SelectionKey.OP_READ)); + key.interestOps (key.interestOps() & (~SelectionKey.OP_WRITE)); this.notify(); // awaken the thread } @@ -190,7 +191,7 @@ return; } // resume interest in OP_READ, OP_WRITE - key.interestOps (key.interestOps() | SelectionKey.OP_READ | SelectionKey.OP_WRITE); + key.interestOps (key.interestOps() | SelectionKey.OP_READ); // cycle the selector so this key is active again key.selector().wakeup(); } --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org