diff options
author | Martin Ritchie <ritchiem@apache.org> | 2007-03-13 13:23:14 +0000 |
---|---|---|
committer | Martin Ritchie <ritchiem@apache.org> | 2007-03-13 13:23:14 +0000 |
commit | 1cb785d8ebfb6b810e0b633e72efadbba252e6bd (patch) | |
tree | ef17af580087ce1c3c5314aee18367d874265fdb | |
parent | 318dafa1e4055d0c4c4d55e3eda096a2293a62db (diff) | |
download | qpid-python-1cb785d8ebfb6b810e0b633e72efadbba252e6bd.tar.gz |
Fixed bug where non durable queues would be attempted to be deleted from the store
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@517683 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeleteHandler.java | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeleteHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeleteHandler.java index 0c7de312a7..eb7089afdc 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeleteHandler.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/QueueDeleteHandler.java @@ -34,7 +34,7 @@ import org.apache.qpid.server.store.MessageStore; import org.apache.qpid.server.virtualhost.VirtualHost; import org.apache.qpid.server.AMQChannel; -public class QueueDeleteHandler implements StateAwareMethodListener<QueueDeleteBody> +public class QueueDeleteHandler implements StateAwareMethodListener<QueueDeleteBody> { private static final QueueDeleteHandler _instance = new QueueDeleteHandler(); @@ -56,7 +56,7 @@ public class QueueDeleteHandler implements StateAwareMethodListener<QueueDelete } - public void methodReceived(AMQStateManager stateManager, AMQMethodEvent<QueueDeleteBody> evt) throws AMQException + public void methodReceived(AMQStateManager stateManager, AMQMethodEvent<QueueDeleteBody> evt) throws AMQException { AMQProtocolSession session = stateManager.getProtocolSession(); VirtualHost virtualHost = session.getVirtualHost(); @@ -65,9 +65,9 @@ public class QueueDeleteHandler implements StateAwareMethodListener<QueueDelete QueueDeleteBody body = evt.getMethod(); AMQQueue queue; - if(body.queue == null) + if (body.queue == null) { - AMQChannel channel = session.getChannel(evt.getChannelId()); + AMQChannel channel = session.getChannel(evt.getChannelId()); if (channel == null) { @@ -82,35 +82,40 @@ public class QueueDeleteHandler implements StateAwareMethodListener<QueueDelete queue = queueRegistry.getQueue(body.queue); } - if(queue == null) + if (queue == null) { - if(_failIfNotFound) + if (_failIfNotFound) { throw body.getChannelException(AMQConstant.NOT_FOUND, "Queue " + body.queue + " does not exist."); } } else { - if(body.ifEmpty && !queue.isEmpty()) + if (body.ifEmpty && !queue.isEmpty()) { - throw body.getChannelException(AMQConstant.IN_USE, "Queue: " + body.queue + " is not empty." ); + throw body.getChannelException(AMQConstant.IN_USE, "Queue: " + body.queue + " is not empty."); } - else if(body.ifUnused && !queue.isUnused()) - { + else if (body.ifUnused && !queue.isUnused()) + { // TODO - Error code - throw body.getChannelException(AMQConstant.IN_USE, "Queue: " + body.queue + " is still used." ); + throw body.getChannelException(AMQConstant.IN_USE, "Queue: " + body.queue + " is still used."); } else { int purged = queue.delete(body.ifUnused, body.ifEmpty); - store.removeQueue(queue.getName()); + + if (queue.isDurable()) + { + store.removeQueue(queue.getName()); + } + // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0) // TODO: Connect this to the session version obtained from ProtocolInitiation for this session. // Be aware of possible changes to parameter order as versions change. session.writeFrame(QueueDeleteOkBody.createAMQFrame(evt.getChannelId(), - (byte)8, (byte)0, // AMQP version (major, minor) - purged)); // messageCount + (byte) 8, (byte) 0, // AMQP version (major, minor) + purged)); // messageCount } } } |