Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 23DB418B7D for ; Mon, 26 Oct 2015 18:06:44 +0000 (UTC) Received: (qmail 53491 invoked by uid 500); 26 Oct 2015 18:06:44 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 53366 invoked by uid 500); 26 Oct 2015 18:06:44 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 53347 invoked by uid 99); 26 Oct 2015 18:06:43 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Oct 2015 18:06:43 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4E4DEE05E1; Mon, 26 Oct 2015 18:06:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: clebertsuconic@apache.org To: commits@activemq.apache.org Date: Mon, 26 Oct 2015 18:06:44 -0000 Message-Id: <78c306db221a4030a687c6147edbea01@git.apache.org> In-Reply-To: <7dc70b42df574e309acce3ec33a1a20b@git.apache.org> References: <7dc70b42df574e309acce3ec33a1a20b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] activemq-artemis git commit: Small tweak on test 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 Authored: Mon Oct 26 14:06:20 2015 -0400 Committer: Clebert Suconic 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());