From b9805f7ac09e2cd601de99ca8c09a1f367a9687d Mon Sep 17 00:00:00 2001 From: Timothy Bish Date: Tue, 12 Jan 2016 13:51:56 -0500 Subject: [PATCH] NO-JIRA Update test to ACK in transacted batches to group Ack values to avoid the test failure based on the even spread of acks across journal files preventing file GC which causes the test to fail. --- .../bugs/TransactedStoreUsageSuspendResumeTest.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/TransactedStoreUsageSuspendResumeTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/TransactedStoreUsageSuspendResumeTest.java index ebc3e373d6..99a3e9eedb 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/TransactedStoreUsageSuspendResumeTest.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/TransactedStoreUsageSuspendResumeTest.java @@ -16,10 +16,13 @@ */ package org.apache.activemq.bugs; +import static org.junit.Assert.assertTrue; + import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; + import javax.jms.BytesMessage; import javax.jms.Connection; import javax.jms.ConnectionFactory; @@ -29,6 +32,7 @@ import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Session; + import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.TestSupport; import org.apache.activemq.broker.BrokerService; @@ -42,9 +46,6 @@ import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -import static org.junit.Assert.assertTrue; - // https://issues.apache.org/jira/browse/AMQ-4262 public class TransactedStoreUsageSuspendResumeTest { private static final Logger LOG = LoggerFactory.getLogger(TransactedStoreUsageSuspendResumeTest.class); @@ -86,13 +87,16 @@ public class TransactedStoreUsageSuspendResumeTest { do { Message message = consumer.receive(5000); if (message != null) { - session.commit(); + if ((messagesReceivedCountDown.getCount() % (MAX_MESSAGES / 5)) == 0) { + session.commit(); + } messagesReceivedCountDown.countDown(); } if (messagesReceivedCountDown.getCount() % 500 == 0) { LOG.info("remaining to receive: " + messagesReceivedCountDown.getCount()); } } while (messagesReceivedCountDown.getCount() != 0); + session.commit(); consumer.close(); session.close(); connection.close();