mirror of https://github.com/apache/activemq.git
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:
parent
e1f170da6e
commit
163ad5d4a9
|
@ -666,7 +666,7 @@ public class ActiveMQMessageConsumer implements MessageAvailableConsumer, StatsC
|
||||||
@Override
|
@Override
|
||||||
public void close() throws JMSException {
|
public void close() throws JMSException {
|
||||||
if (!unconsumedMessages.isClosed()) {
|
if (!unconsumedMessages.isClosed()) {
|
||||||
if (session.getTransactionContext().isInTransaction()) {
|
if (!deliveredMessages.isEmpty() && session.getTransactionContext().isInTransaction()) {
|
||||||
session.getTransactionContext().addSynchronization(new Synchronization() {
|
session.getTransactionContext().addSynchronization(new Synchronization() {
|
||||||
@Override
|
@Override
|
||||||
public void afterCommit() throws Exception {
|
public void afterCommit() throws Exception {
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class AMQ4472Test {
|
||||||
public void testLostMessage() {
|
public void testLostMessage() {
|
||||||
Connection connection = null;
|
Connection connection = null;
|
||||||
try {
|
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 = connectionFactory.createConnection();
|
||||||
connection.start();
|
connection.start();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue