activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject git commit: https://issues.apache.org/jira/browse/AMQ-4818
Date Tue, 22 Jul 2014 21:53:50 GMT
Repository: activemq
Updated Branches:
  refs/heads/trunk 9e139017e -> d223ea979


https://issues.apache.org/jira/browse/AMQ-4818

added patch with addition of getter for link stealing enabled and a unit
test.

Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/d223ea97
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/d223ea97
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/d223ea97

Branch: refs/heads/trunk
Commit: d223ea979f23130b2af2e0bb896456f62666683b
Parents: 9e13901
Author: Timothy Bish <tabish121@gmail.com>
Authored: Tue Jul 22 17:53:39 2014 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Tue Jul 22 17:53:39 2014 -0400

----------------------------------------------------------------------
 .../org/apache/activemq/broker/Connector.java   |  6 +++
 .../activemq/broker/jmx/ConnectorView.java      | 54 +++++++++++++++++++-
 .../activemq/broker/jmx/ConnectorViewMBean.java | 47 ++++++++++++++---
 .../apache/activemq/broker/jmx/MBeanTest.java   | 25 +++++++++
 4 files changed, 125 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/d223ea97/activemq-broker/src/main/java/org/apache/activemq/broker/Connector.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/Connector.java b/activemq-broker/src/main/java/org/apache/activemq/broker/Connector.java
index 1dd7f17..acb7e69 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/Connector.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/Connector.java
@@ -66,4 +66,10 @@ public interface Connector extends Service {
      * @return true/false if link stealing is enabled
      */
     boolean isAllowLinkStealing();
+    
+    /**
+     * @return The comma separated string of regex patterns to match 
+     * broker names for cluster client updates
+     */
+    String getUpdateClusterFilter();
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/d223ea97/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectorView.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectorView.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectorView.java
index 208648b..51d104b 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectorView.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectorView.java
@@ -27,6 +27,7 @@ public class ConnectorView implements ConnectorViewMBean {
         this.connector = connector;
     }
 
+    @Override
     public void start() throws Exception {
         connector.start();
     }
@@ -35,6 +36,7 @@ public class ConnectorView implements ConnectorViewMBean {
         return getBrokerInfo().getBrokerName();
     }
 
+    @Override
     public void stop() throws Exception {
         connector.stop();
     }
@@ -50,6 +52,7 @@ public class ConnectorView implements ConnectorViewMBean {
     /**
      * Resets the statistics
      */
+    @Override
     public void resetStatistics() {
         connector.getStatistics().reset();
     }
@@ -57,6 +60,7 @@ public class ConnectorView implements ConnectorViewMBean {
     /**
      * enable statistics gathering
      */
+    @Override
     public void enableStatistics() {
         connector.getStatistics().setEnabled(true);
     }
@@ -64,15 +68,17 @@ public class ConnectorView implements ConnectorViewMBean {
     /**
      * disable statistics gathering
      */
+    @Override
     public void disableStatistics() {
         connector.getStatistics().setEnabled(false);
     }
 
     /**
      * Returns true if statistics is enabled
-     * 
+     *
      * @return true if statistics is enabled
      */
+    @Override
     public boolean isStatisticsEnabled() {
         return connector.getStatistics().isEnabled();
     }
@@ -80,8 +86,54 @@ public class ConnectorView implements ConnectorViewMBean {
     /**
      * Returns the number of current connections
      */
+    @Override
     public int connectionCount() {
         return connector.connectionCount();
     }
 
+    /**
+     * Returns true if updating cluster client URL is enabled
+     *
+     * @return true if update cluster client URL is enabled
+     */
+    @Override
+    public boolean isUpdateClusterClients() {
+        return this.connector.isUpdateClusterClientsOnRemove();
+    }
+
+    /**
+     * Returns true if rebalancing cluster clients is enabled
+     *
+     * @return true if rebalance cluster clients is enabled
+     */
+    @Override
+    public boolean isRebalanceClusterClients() {
+        return this.connector.isRebalanceClusterClients();
+    }
+
+    /**
+     * Returns true if updating cluster client URL when brokers are removed is
+     * enabled
+     *
+     * @return true if update cluster client URL when brokers are removed is
+     *         enabled
+     */
+    @Override
+    public boolean isUpdateClusterClientsOnRemove() {
+        return this.connector.isUpdateClusterClientsOnRemove();
+    }
+
+    /**
+     * @return The comma separated string of regex patterns to match broker
+     *         names for cluster client updates
+     */
+    @Override
+    public String getUpdateClusterFilter() {
+        return this.connector.getUpdateClusterFilter();
+    }
+
+    @Override
+    public boolean isAllowLinkStealingEnabled() {
+        return this.connector.isAllowLinkStealing();
+    }
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/d223ea97/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java
index 0a6a9f2..6649af2 100755
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java
@@ -22,13 +22,13 @@ public interface ConnectorViewMBean extends Service {
 
     @MBeanInfo("Connection count")
     int connectionCount();
-    
+
     /**
      * Resets the statistics
      */
     @MBeanInfo("Resets the statistics")
     void resetStatistics();
-    
+
     /**
      * enable statistics gathering
      */
@@ -37,16 +37,51 @@ public interface ConnectorViewMBean extends Service {
 
     /**
      * disable statistics gathering
-     */  
+     */
     @MBeanInfo("Disables statistics gathering")
     void disableStatistics();
-    
+
     /**
      * Returns true if statistics is enabled
-     * 
+     *
      * @return true if statistics is enabled
-     */  
+     */
     @MBeanInfo("Statistics gathering enabled")
     boolean isStatisticsEnabled();
 
+    /**
+     * Returns true if link stealing is enabled on this Connector
+     *
+     * @returns true if link stealing is enabled.
+     */
+    @MBeanInfo("Link Stealing enabled")
+    boolean isAllowLinkStealingEnabled();
+
+    /**
+     * @return true if update client connections when brokers leave/join a cluster
+     */
+    @MBeanInfo("Update client URL's when brokers leave/join a custer enabled")
+    boolean isUpdateClusterClients();
+
+    /**
+     * @return true if clients should be re-balanced across the cluster
+     */
+    @MBeanInfo("Rebalance clients across the broker cluster enabled")
+    boolean isRebalanceClusterClients();
+
+    /**
+     * @return true if clients should be updated when
+     * a broker is removed from a broker
+     */
+    @MBeanInfo("Update clients when a broker is removed from a network enabled.")
+    boolean isUpdateClusterClientsOnRemove();
+
+    /**
+     * @return The comma separated string of regex patterns to match
+     * broker names for cluster client updates
+     */
+    @MBeanInfo("Comma separated list of regex patterns to match broker names for cluster
client updates.")
+    String getUpdateClusterFilter();
+
+
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/d223ea97/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
index a853b3e..88ab95a 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
@@ -1361,6 +1361,31 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
         session.close();
     }
 
+    public void testConnectorView() throws Exception {
+        ConnectorViewMBean connector = getProxyToConnectionView("tcp");
+        assertNotNull(connector);
+
+        assertFalse(connector.isRebalanceClusterClients());
+        assertFalse(connector.isUpdateClusterClientsOnRemove());
+        assertFalse(connector.isUpdateClusterClients());
+        assertFalse(connector.isAllowLinkStealingEnabled());
+    }
+
+    protected ConnectorViewMBean getProxyToConnectionView(String connectionType) throws Exception
{
+        ObjectName connectorQuery = new ObjectName(
+            "org.apache.activemq:type=Broker,brokerName=localhost,connector=clientConnectors,connectorName="+connectionType+"_//*");
+
+        Set<ObjectName> results = broker.getManagementContext().queryNames(connectorQuery,
null);
+
+        if (results == null || results.isEmpty() || results.size() > 1) {
+            throw new Exception("Unable to find the exact Connector instance.");
+        }
+
+        ConnectorViewMBean proxy = (ConnectorViewMBean) broker.getManagementContext()
+                .newProxyInstance(results.iterator().next(), ConnectorViewMBean.class, true);
+        return proxy;
+    }
+
     public void testDynamicProducers() throws Exception {
         connection = connectionFactory.createConnection();
         Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);


Mime
View raw message