[jboss-cvs] JBoss Messaging SVN: r7719 - trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 12 13:01:19 EDT 2009


Author: jmesnil
Date: 2009-08-12 13:01:19 -0400 (Wed, 12 Aug 2009)
New Revision: 7719

Modified:
   trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/ServerDump.java
Log:
added JMS topic infos when dumping the server

Modified: trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/ServerDump.java
===================================================================
--- trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/ServerDump.java	2009-08-12 15:32:09 UTC (rev 7718)
+++ trunk/examples/soak/reconnect/src/org/jboss/jms/soak/example/reconnect/ServerDump.java	2009-08-12 17:01:19 UTC (rev 7719)
@@ -40,6 +40,7 @@
 import org.jboss.messaging.core.management.MessagingServerControl;
 import org.jboss.messaging.core.management.ObjectNames;
 import org.jboss.messaging.jms.server.management.JMSQueueControl;
+import org.jboss.messaging.jms.server.management.TopicControl;
 
 /**
  * A MemoryDump
@@ -85,7 +86,7 @@
                                                                                                                               ObjectNames.getMessagingServerObjectName(),
                                                                                                                               MessagingServerControl.class,
                                                                                                                               false);
-               String info =         "\n**** Server Dump ****\n";
+               String info = "\n**** Server Dump ****\n";
                info += String.format("date:            %s\n", new Date());
                info += String.format("heap memory:     used=%s, max=%s\n",
                                      sizeof(heapMemory.getUsed()),
@@ -96,6 +97,7 @@
                info += String.format("# of thread:     %d\n", threadMXBean.getThreadCount());
                info += String.format("# of conns:      %d\n", messagingServer.getConnectionCount());
                info += appendQueuesInfo();
+               info += appendTopicsInfo();
                info += "********************\n";
                log.info(info);
             }
@@ -107,10 +109,14 @@
 
          private String appendQueuesInfo() throws Exception
          {
-            String info = "JMS queues:\n";
+            String info = "";
 
             ObjectName query = ObjectName.getInstance("org.jboss.messaging:module=JMS,type=Queue,*");
             Set names = ManagementFactory.getPlatformMBeanServer().queryNames(query, null);
+            if (!names.isEmpty())
+            {
+               info += "JMS queues:\n";
+            }
             for (Iterator iterator = names.iterator(); iterator.hasNext();)
             {
                ObjectName on = (ObjectName)iterator.next();
@@ -128,6 +134,33 @@
 
             return info;
          }
+
+         private String appendTopicsInfo() throws Exception
+         {
+            String info = "";
+
+            ObjectName query = ObjectName.getInstance("org.jboss.messaging:module=JMS,type=Topic,*");
+            Set names = ManagementFactory.getPlatformMBeanServer().queryNames(query, null);
+            if (!names.isEmpty())
+            {
+               info += "JMS topics:\n";
+            }
+            for (Iterator iterator = names.iterator(); iterator.hasNext();)
+            {
+               ObjectName on = (ObjectName)iterator.next();
+               TopicControl topic = (TopicControl)MBeanServerInvocationHandler.newProxyInstance(ManagementFactory.getPlatformMBeanServer(),
+                                                                                                on,
+                                                                                                TopicControl.class,
+                                                                                                false);
+               info += String.format("\t%s: %s subscription (%s non-durable) receiving %s message\n",
+                                     topic.getName(),
+                                     topic.getSubscriptionCount(),
+                                     topic.getNonDurableSubscriptionCount(),
+                                     topic.getMessageCount());
+            }
+
+            return info;
+         }
       };
    }
 




More information about the jboss-cvs-commits mailing list