activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [2/2] activemq-artemis git commit: Small tweak on test
Date Mon, 26 Oct 2015 18:06:44 GMT
Small tweak on test


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/992c34bc
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/992c34bc
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/992c34bc

Branch: refs/heads/master
Commit: 992c34bc6a6123207eb99456852e05506e5e9e01
Parents: 32e6d9c
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Mon Oct 26 14:06:20 2015 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Mon Oct 26 14:06:26 2015 -0400

----------------------------------------------------------------------
 .../integration/client/SessionCloseOnGCTest.java    | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/992c34bc/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCloseOnGCTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCloseOnGCTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCloseOnGCTest.java
index a5d8e1c..d5a13d9 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCloseOnGCTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCloseOnGCTest.java
@@ -216,20 +216,8 @@ public class SessionCloseOnGCTest extends ActiveMQTestBase {
 
       ActiveMQTestBase.checkWeakReferences(ref1, ref2, ref3);
 
-      int count = 0;
-      final int TOTAL_SLEEP_TIME = 400;
-      final int MAX_COUNT = 20;
-      while (count++ < MAX_COUNT) {
-         /*
-          * The assertion is vulnerable to races, both in the session closing as well as
the return
-          * value of the sessions.size() (i.e. HashSet.size()).
-          */
-         synchronized (this) {
-            // synchronized block will (as a side effect) force sync all field values
-            if (sf.numSessions() == 0)
-               break;
-            Thread.sleep(TOTAL_SLEEP_TIME / MAX_COUNT);
-         }
+      for (int i = 0; i < 1000 && sf.numSessions() != 0; i++) {
+         forceGC();
       }
       Assert.assertEquals("# sessions", 0, sf.numSessions());
       Assert.assertEquals("# connections", 1, sf.numConnections());


Mime
View raw message