summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2009-12-14 01:40:54 +0000
committerRobert Gemmell <robbie@apache.org>2009-12-14 01:40:54 +0000
commitdebfd98430164ed33ade453ba867568ded31b844 (patch)
tree962e07aaeffd5ed5c2daa99fed05a501e335c589
parentf2b9b400af5cfa5b389aac91072ab24f7a3f4ed1 (diff)
downloadqpid-python-debfd98430164ed33ade453ba867568ded31b844.tar.gz
QPID-1878: use getAttribute method directly with the attribute name to retrieve the current message count
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@890152 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java33
1 files changed, 6 insertions, 27 deletions
diff --git a/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java
index 7c82682c27..fcf0464ced 100644
--- a/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java
+++ b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java
@@ -22,10 +22,10 @@
package org.apache.qpid.commands.objects;
import javax.management.MBeanServerConnection;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanInfo;
import javax.management.ObjectName;
+import org.apache.qpid.management.common.mbeans.ManagedQueue;
+
public class QueueObject extends ObjectNames
{
public QueueObject(MBeanServerConnection mbsc)
@@ -47,33 +47,12 @@ public class QueueObject extends ObjectNames
public int getmessagecount(ObjectName queue)
{
- int attr_count = 0;
- String value;
- Integer depth = null;
-
+ Number depth = null;
+
try
{
- MBeanInfo bean_info;
- bean_info = mbsc.getMBeanInfo(queue);
- MBeanAttributeInfo[] attr_info = bean_info.getAttributes();
- if (attr_info == null)
- return 0;
- else
- {
- for (MBeanAttributeInfo attr : attr_info)
- {
- Object toWrite = null;
- attr_count++;
- toWrite = mbsc.getAttribute(queue, attr.getName());
- if (attr_count == 7)
- {
- value = toWrite.toString();
- depth = new Integer(value);
- }
- }
-
- }
-
+ depth = (Number) mbsc.getAttribute(queue, ManagedQueue.ATTR_MSG_COUNT);
+
}
catch (Exception ex)
{