summaryrefslogtreecommitdiff
path: root/java/management
diff options
context:
space:
mode:
Diffstat (limited to 'java/management')
-rw-r--r--java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedQueue.java10
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/queue/QueueOperationsTabControl.java17
2 files changed, 22 insertions, 5 deletions
diff --git a/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedQueue.java b/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedQueue.java
index abcbaa8693..ff4edb4ddd 100644
--- a/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedQueue.java
+++ b/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/ManagedQueue.java
@@ -291,14 +291,18 @@ public interface ManagedQueue
void deleteMessageFromTop() throws IOException, JMException;
/**
- * Clears the queue by deleting all the undelivered messages from the queue.
+ * Clears the queue by deleting all the messages from the queue that have not been acquired by consumers"
+ *
+ * Since Qpid JMX API 1.3 this returns the number of messages deleted. Prior to this, the return type was void.
+ * @return the number of messages deleted
* @throws IOException
* @throws JMException
*/
@MBeanOperation(name="clearQueue",
- description="Clears the queue by deleting all the undelivered messages from the queue",
+ description="Clears the queue by deleting all the messages from the queue " +
+ "that have not been acquired by consumers",
impact= MBeanOperationInfo.ACTION)
- void clearQueue() throws IOException, JMException;
+ Long clearQueue() throws IOException, JMException;
/**
* Moves the messages in given range of message Ids to given Queue. QPID-170
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/queue/QueueOperationsTabControl.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/queue/QueueOperationsTabControl.java
index c838a3e414..c7c7a1791a 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/queue/QueueOperationsTabControl.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/queue/QueueOperationsTabControl.java
@@ -457,8 +457,21 @@ public class QueueOperationsTabControl extends TabControl
{
try
{
- _qmb.clearQueue();
- ViewUtility.operationResultFeedback(null, "Queue cleared", null);
+ if(_ApiVersion.greaterThanOrEqualTo(1, 3))
+ {
+ //Qpid JMX API 1.3+, returns the number of messages deleted
+ Long numDeleted = _qmb.clearQueue();
+ String message = "Queue cleared of " + numDeleted +
+ " non-acquired message" + (numDeleted == 1 ? "": "s");
+
+ ViewUtility.operationResultFeedback(null, message, null);
+ }
+ else
+ {
+ //Qpid JMX API 1.2 or below, void return
+ _qmb.clearQueue();
+ ViewUtility.operationResultFeedback(null, "Queue cleared of non-acquired messages", null);
+ }
}
catch (Exception e2)
{