qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@apache.org
Subject svn commit: r890152 - /qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java
Date Mon, 14 Dec 2009 01:40:54 GMT
Author: robbie
Date: Mon Dec 14 01:40:54 2009
New Revision: 890152

URL: http://svn.apache.org/viewvc?rev=890152&view=rev
Log:
QPID-1878: use getAttribute method directly with the attribute name to retrieve the current
message count

Modified:
    qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java?rev=890152&r1=890151&r2=890152&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java
(original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java
Mon Dec 14 01:40:54 2009
@@ -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 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)
         {



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message