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.
This commit is contained in:
Timothy Bish 2016-01-12 13:51:56 -05:00
parent 505a76a8bb
commit b9805f7ac0
1 changed files with 8 additions and 4 deletions

View File

@ -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) {
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();