summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2011-01-27 12:37:51 +0000
committerRobert Gemmell <robbie@apache.org>2011-01-27 12:37:51 +0000
commit248b21aed2d7aa3181802f73033aa8206d0ed828 (patch)
treeca833c33cf02df9acf21a16c0c6196f265b59873 /java
parent0149d6c1e8adeab6bbd6d2ff88edd39d96987e35 (diff)
downloadqpid-python-248b21aed2d7aa3181802f73033aa8206d0ed828.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
Diffstat (limited to 'java')
-rw-r--r--java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionCloseTest.java13
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)