You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2024/06/20 16:08:01 UTC
(activemq-artemis) branch main updated: ARTEMIS-4814 Speeding up WildcardAddressManagerUnitTest::testConcurrentCalls2
This is an automated email from the ASF dual-hosted git repository.
clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
The following commit(s) were added to refs/heads/main by this push:
new 925e338874 ARTEMIS-4814 Speeding up WildcardAddressManagerUnitTest::testConcurrentCalls2
925e338874 is described below
commit 925e33887400b71a5d5ccb8fecd0b7466bbed417
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Thu Jun 20 11:45:16 2024 -0400
ARTEMIS-4814 Speeding up WildcardAddressManagerUnitTest::testConcurrentCalls2
This test is spinning a concurrent call on getDirectBindings
Since I added a synchronization point to get the Bindings the test could
be taking up to 5 seconds, being a variance between 500ms and 5 seconds.
Adding Thread.sleep(1) on this loop solved the issue as it is now letting other threads to do work
since I'm starting more executors than cores I have on my box.
---
.../unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java
index d381cf7d29..b4643b7de9 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java
@@ -408,6 +408,7 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase {
CountDownLatch latch = new CountDownLatch(threads);
+ CountDownLatch latch2 = new CountDownLatch(1);
AtomicInteger errors = new AtomicInteger(0);
AtomicBoolean running = new AtomicBoolean(true);
@@ -418,10 +419,13 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase {
while (running.get()) {
// just to make things worse
simpleAddressManager.getDirectBindings(addressSimpleString);
+ Thread.sleep(1);
}
} catch (Exception e) {
logger.warn(e.getMessage(), e);
errors.incrementAndGet();
+ } finally {
+ latch2.countDown();
}
});
@@ -451,6 +455,8 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase {
running.set(false);
+ Assertions.assertTrue(latch2.await(1, TimeUnit.MINUTES));
+
Assertions.assertEquals(0, errors.get());
Collection<Binding> bindings = simpleAddressManager.getDirectBindings(SimpleString.of(address));
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@activemq.apache.org
For additional commands, e-mail: commits-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact