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 2022/03/01 17:11:14 UTC
[activemq-artemis] branch main updated: NO-JIRA Improving expiry test with an executor
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 60ce5f9 NO-JIRA Improving expiry test with an executor
60ce5f9 is described below
commit 60ce5f9cf1f1cd4b19f17ccbfc288d1430efcc47
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Tue Mar 1 11:56:07 2022 -0500
NO-JIRA Improving expiry test with an executor
---
.../integration/paging/MessagesExpiredPagingTest.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/MessagesExpiredPagingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/MessagesExpiredPagingTest.java
index eae7795..a16b9ad 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/MessagesExpiredPagingTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/MessagesExpiredPagingTest.java
@@ -22,6 +22,8 @@ import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@@ -61,17 +63,15 @@ public class MessagesExpiredPagingTest extends ActiveMQTestBase {
Queue[] queues = new Queue[NUMBER_OF_QUEUES];
- Thread[] peskyExpires = new Thread[NUMBER_OF_QUEUES];
+ ExecutorService expiresExecutor;
@After
@Override
public void tearDown() throws Exception {
running.set(false);
- for (Thread t : peskyExpires) {
- t.join(5000);
- Assert.assertFalse(t.isAlive());
- }
+ expiresExecutor.shutdown();
+ Assert.assertTrue(expiresExecutor.awaitTermination(10, TimeUnit.SECONDS));
super.tearDown();
}
@@ -79,6 +79,7 @@ public class MessagesExpiredPagingTest extends ActiveMQTestBase {
@Override
public void setUp() throws Exception {
super.setUp();
+ expiresExecutor = Executors.newFixedThreadPool(NUMBER_OF_QUEUES);
Configuration config = createDefaultConfig(0, true).setJournalSyncNonTransactional(false);
@@ -100,7 +101,8 @@ public class MessagesExpiredPagingTest extends ActiveMQTestBase {
for (int i = 0; i < NUMBER_OF_QUEUES; i++) {
Queue queue = server.createQueue(new QueueConfiguration("q" + i).setRoutingType(RoutingType.MULTICAST).setAddress(ADDRESS));
queues[i] = queue;
- peskyExpires[i] = new Thread(() -> {
+ expiresExecutor.execute(() -> {
+ Thread.currentThread().setName("Expiry on " + queue.getName() + ".." + Thread.currentThread().getName());
while (running.get()) {
try {
// I am exagerating calls into expireReferences