From 4f64702bcd4da0ce73622ec807d99cc3f50f309b Mon Sep 17 00:00:00 2001 From: Robert Godfrey Date: Mon, 10 Feb 2014 00:30:33 +0000 Subject: QPID-5504 : Fix bug in routeToAlternate which left queue entries in database if there were no alternates to route to git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1566479 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/qpid/server/queue/QueueEntryImpl.java | 47 ++++++++++++---------- 1 file changed, 25 insertions(+), 22 deletions(-) (limited to 'qpid/java') diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueEntryImpl.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueEntryImpl.java index 8b81a87903..4ee9df5e5d 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueEntryImpl.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/QueueEntryImpl.java @@ -369,42 +369,45 @@ public abstract class QueueEntryImpl implements QueueEntry final AMQQueue currentQueue = getQueue(); Exchange alternateExchange = currentQueue.getAlternateExchange(); boolean autocommit = txn == null; + int enqueues; + + if(autocommit) + { + txn = new LocalTransaction(getQueue().getVirtualHost().getMessageStore()); + } + if (alternateExchange != null) { - if(autocommit) - { - txn = new LocalTransaction(getQueue().getVirtualHost().getMessageStore()); - } - int enqueues = alternateExchange.send(getMessage(), + enqueues = alternateExchange.send(getMessage(), getInstanceProperties(), txn, action); + } + else + { + enqueues = 0; + } - txn.dequeue(currentQueue, getMessage(), new ServerTransaction.Action() + txn.dequeue(currentQueue, getMessage(), new ServerTransaction.Action() + { + public void postCommit() { - public void postCommit() - { - delete(); - } - - public void onRollback() - { - - } - }); + delete(); + } - if(autocommit) + public void onRollback() { - txn.commit(); + } - return enqueues; + }); - } - else + if(autocommit) { - return 0; + txn.commit(); } + return enqueues; + } public boolean isQueueDeleted() -- cgit v1.2.1