qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@apache.org
Subject svn commit: r1064108 - /qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionCloseTest.java
Date Thu, 27 Jan 2011 12:37:52 GMT
Author: robbie
Date: Thu Jan 27 12:37:51 2011
New Revision: 1064108

URL: http://svn.apache.org/viewvc?rev=1064108&view=rev
Log:
QPID-3013: use an equation based delta threshold that takes processor count into consideration

Modified:
    qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionCloseTest.java

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionCloseTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionCloseTest.java?rev=1064108&r1=1064107&r2=1064108&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionCloseTest.java
(original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionCloseTest.java
Thu Jan 27 12:37:51 2011
@@ -45,10 +45,6 @@ public class ConnectionCloseTest extends
 
     public void testSendReceiveClose() throws Exception
     {
-        //Create an initial connection to ensure any necessary thread pools
-        //are initialised before the test really begins.
-        Connection intialConnection = getConnection();
-        
         Map<Thread,StackTraceElement[]> before = Thread.getAllStackTraces();
 
         for (int i = 0; i < 50; i++)
@@ -76,8 +72,6 @@ public class ConnectionCloseTest extends
             assertEquals(m.getText(), "test");
             receiver.close();
         }
-        
-        intialConnection.close();
 
         // The finalizer is notifying connector thread waiting on a selector key.
         // This should leave the finalizer enough time to notify those threads 
@@ -87,7 +81,7 @@ public class ConnectionCloseTest extends
         }
 
         Map<Thread,StackTraceElement[]> after = Thread.getAllStackTraces();
-
+        
         Map<Thread,StackTraceElement[]> delta = new HashMap<Thread,StackTraceElement[]>(after);
         for (Thread t : before.keySet())
         {
@@ -96,9 +90,12 @@ public class ConnectionCloseTest extends
 
         dumpStacks(delta);
 
+        int deltaThreshold = (isExternalBroker()? 1 : 2) //InVM creates more thread pools
in the same VM
+                            * (Runtime.getRuntime().availableProcessors() + 1) + 5; 
+
         assertTrue("Spurious thread creation exceeded threshold, " +
                    delta.size() + " threads created.",
-                   delta.size() < 10);
+                   delta.size() < deltaThreshold);
     }
 
     private void dumpStacks(Map<Thread,StackTraceElement[]> map)



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message