activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1430817 - in /activemq/trunk: activemq-console/src/main/java/org/apache/activemq/console/command/ activemq-console/src/main/java/org/apache/activemq/console/filter/ activemq-console/src/main/java/org/apache/activemq/console/util/ activemq-...
Date Wed, 09 Jan 2013 12:22:38 GMT
Author: dejanb
Date: Wed Jan  9 12:22:37 2013
New Revision: 1430817

URL: http://svn.apache.org/viewvc?rev=1430817&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-4237 - new jmx and shutdown command

Modified:
    activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ShutdownCommand.java
    activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MBeansObjectNameQueryFilter.java
    activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/util/JmxMBeansUtil.java
    activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java

Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ShutdownCommand.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ShutdownCommand.java?rev=1430817&r1=1430816&r2=1430817&view=diff
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ShutdownCommand.java
(original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/ShutdownCommand.java
Wed Jan  9 12:22:37 2013
@@ -79,7 +79,6 @@ public class ShutdownCommand extends Abs
             } else if (brokerNames.isEmpty()) {
                 // Stop the default broker
                 mbeans = JmxMBeansUtil.getAllBrokers(createJmxConnection());
-
                 // If there is no broker to stop
                 if (mbeans.isEmpty()) {
                     context.printInfo("There are no brokers to stop.");
@@ -130,7 +129,7 @@ public class ShutdownCommand extends Abs
         for (Iterator i = brokerBeans.iterator(); i.hasNext();) {
             brokerObjName = ((ObjectInstance)i.next()).getObjectName();
 
-            String brokerName = brokerObjName.getKeyProperty("BrokerName");
+            String brokerName = brokerObjName.getKeyProperty("brokerName");
             context.print("Stopping broker: " + brokerName);
 
             try {

Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MBeansObjectNameQueryFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MBeansObjectNameQueryFilter.java?rev=1430817&r1=1430816&r2=1430817&view=diff
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MBeansObjectNameQueryFilter.java
(original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/filter/MBeansObjectNameQueryFilter.java
Wed Jan  9 12:22:37 2013
@@ -63,6 +63,7 @@ public class MBeansObjectNameQueryFilter
         // Constructs object name query
         String objNameQuery = "";
         String queryExp = "";
+        String delimiter = "";
         for (Iterator i = queries.iterator(); i.hasNext();) {
             String key = (String)i.next();
             String val = "";
@@ -75,13 +76,11 @@ public class MBeansObjectNameQueryFilter
             if (val.startsWith(QUERY_EXP_PREFIX)) {
                 // do nothing as of the moment
             } else if (!key.equals("") && !val.equals("")) {
-                objNameQuery = objNameQuery + key + "=" + val + ",";
+                objNameQuery += delimiter + key + "=" + val;
+                delimiter = ",";
             }
         }
 
-        // Append * to object name
-        objNameQuery = objNameQuery + "*";
-
         return queryMBeans(new ObjectName(DEFAULT_JMX_DOMAIN + ":" + objNameQuery), queryExp);
     }
 

Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/util/JmxMBeansUtil.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/util/JmxMBeansUtil.java?rev=1430817&r1=1430816&r2=1430817&view=diff
==============================================================================
--- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/util/JmxMBeansUtil.java
(original)
+++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/util/JmxMBeansUtil.java
Wed Jan  9 12:22:37 2013
@@ -42,19 +42,19 @@ public final class JmxMBeansUtil {
     }
 
     public static List getAllBrokers(MBeanServerConnection jmxConnection) throws Exception
{
-        return (new MBeansObjectNameQueryFilter(jmxConnection)).query("Type=Broker");
+        return (new MBeansObjectNameQueryFilter(jmxConnection)).query("type=Broker,brokerName=*");
     }
 
     public static List getBrokersByName(MBeanServerConnection jmxConnection, String brokerName)
throws Exception {
-        return (new MBeansObjectNameQueryFilter(jmxConnection)).query("Type=Broker,BrokerName="
+ brokerName);
+        return (new MBeansObjectNameQueryFilter(jmxConnection)).query("type=Broker,brokerName="
+ brokerName);
     }
 
     public static List getAllBrokers(MBeanServerConnection jmxConnection, Set attributes)
throws Exception {
-        return (new MBeansAttributeQueryFilter(jmxConnection, attributes, new MBeansObjectNameQueryFilter(jmxConnection))).query("Type=Broker");
+        return (new MBeansAttributeQueryFilter(jmxConnection, attributes, new MBeansObjectNameQueryFilter(jmxConnection))).query("type=Broker");
     }
 
     public static List getBrokersByName(MBeanServerConnection jmxConnection, String brokerName,
Set attributes) throws Exception {
-        return (new MBeansAttributeQueryFilter(jmxConnection, attributes, new MBeansObjectNameQueryFilter(jmxConnection))).query("Type=Broker,BrokerName="
+ brokerName);
+        return (new MBeansAttributeQueryFilter(jmxConnection, attributes, new MBeansObjectNameQueryFilter(jmxConnection))).query("type=Broker,brokerName="
+ brokerName);
     }
 
     public static List queryMBeans(MBeanServerConnection jmxConnection, List queryList) throws
Exception {

Modified: activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java?rev=1430817&r1=1430816&r2=1430817&view=diff
==============================================================================
--- activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java
(original)
+++ activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/BrokerFacadeSupport.java
Wed Jan  9 12:22:37 2013
@@ -111,7 +111,7 @@ public abstract class BrokerFacadeSuppor
     @SuppressWarnings("unchecked")
     public Collection<ConnectionViewMBean> getConnections() throws Exception {
         String brokerName = getBrokerName();
-        ObjectName query = new ObjectName("org.apache.activemq:BrokerName=" + brokerName
+ ",Type=Connection,ConnectorName=*,Connection=*");
+        ObjectName query = new ObjectName("org.apache.activemq:type=Broker,brokerName=" +
brokerName + ",connector=clientConnectors,connectorName=*,connectionName=*");
 
         Set<ObjectName> queryResult = queryNames(query, null);
         return getManagedObjects(queryResult.toArray(new ObjectName[queryResult.size()]),
ConnectionViewMBean.class);



Mime
View raw message