diff options
| author | Robert Gemmell <robbie@apache.org> | 2011-01-27 12:37:51 +0000 |
|---|---|---|
| committer | Robert Gemmell <robbie@apache.org> | 2011-01-27 12:37:51 +0000 |
| commit | af37f25981d49ec06df6a092fb9c439e22abce3f (patch) | |
| tree | ca833c33cf02df9acf21a16c0c6196f265b59873 | |
| parent | da4820a79da44b22f0f96d76a56e45a3e6c7bd5e (diff) | |
| download | qpid-python-af37f25981d49ec06df6a092fb9c439e22abce3f.tar.gz | |
QPID-3013: use an equation based delta threshold that takes processor count into consideration
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1064108 13f79535-47bb-0310-9956-ffa450edef68
| -rw-r--r-- | java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionCloseTest.java | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionCloseTest.java b/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionCloseTest.java index 8f9eaf5815..6d1b6de238 100644 --- a/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionCloseTest.java +++ b/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionCloseTest.java @@ -45,10 +45,6 @@ public class ConnectionCloseTest extends QpidBrokerTestCase 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 QpidBrokerTestCase 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 QpidBrokerTestCase } 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 QpidBrokerTestCase 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) |
