Fix for AMQ4472: We can eagerly close a txed consumer if it has not delivered any messages.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1471673 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2013-04-24 21:01:24 +00:00
parent e1f170da6e
commit 163ad5d4a9
2 changed files with 2 additions and 2 deletions

View File

@ -666,7 +666,7 @@ public class ActiveMQMessageConsumer implements MessageAvailableConsumer, StatsC
@Override
public void close() throws JMSException {
if (!unconsumedMessages.isClosed()) {
if (session.getTransactionContext().isInTransaction()) {
if (!deliveredMessages.isEmpty() && session.getTransactionContext().isInTransaction()) {
session.getTransactionContext().addSynchronization(new Synchronization() {
@Override
public void afterCommit() throws Exception {

View File

@ -40,7 +40,7 @@ public class AMQ4472Test {
public void testLostMessage() {
Connection connection = null;
try {
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.useJmx=false&jms.prefetchPolicy.all=0");
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.useJmx=false");
connection = connectionFactory.createConnection();
connection.start();