tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject svn commit: r629843 - in /tomcat/trunk: java/org/apache/catalina/tribes/transport/nio/NioReceiver.java test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java
Date Thu, 21 Feb 2008 16:06:19 GMT
Author: fhanik
Date: Thu Feb 21 08:06:17 2008
New Revision: 629843

URL: http://svn.apache.org/viewvc?rev=629843&view=rev
Log:
modify test code to report more info
avoid concurrency during closedown

Modified:
    tomcat/trunk/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java
    tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java

Modified: tomcat/trunk/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java?rev=629843&r1=629842&r2=629843&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java (original)
+++ tomcat/trunk/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java Thu Feb 21
08:06:17 2008
@@ -281,7 +281,7 @@
                 // get an iterator over the set of selected keys
                 Iterator it = selector.selectedKeys().iterator();
                 // look at each key in the selected set
-                while (it.hasNext()) {
+                while (it.hasNext() && selector!=null) {
                     SelectionKey key = (SelectionKey) it.next();
                     // Is a new connection coming in?
                     if (key.isAcceptable()) {
@@ -310,7 +310,7 @@
                     }
 
                     // remove key from selected set, it's been handled
-                    it.remove();
+                    if (selector!=null) it.remove();
                 }
             } catch (java.nio.channels.ClosedSelectorException cse) {
                 // ignore is normal at shutdown or stop listen socket

Modified: tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java?rev=629843&r1=629842&r2=629843&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java (original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java Thu Feb
21 08:06:17 2008
@@ -104,9 +104,9 @@
                     try {
                         long start = System.currentTimeMillis();
                         for (int i = 0; i < msgCount; i++) {
-                            int cnt = counter.addAndGet(1);
+                            int cnt = counter.getAndAdd(1);
                             channel1.send(new Member[] {channel2.getLocalMember(false)},
Data.createRandomData(1024,cnt),Channel.SEND_OPTIONS_UDP);
-                            Thread.currentThread().sleep(10);
+                            //Thread.currentThread().sleep(10);
                         }
                         System.out.println("Thread["+this.getName()+"] sent "+msgCount+"
messages in "+(System.currentTimeMillis()-start)+" ms.");
                     }catch ( Exception x ) {



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


Mime
View raw message