activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r924349 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker: Connector.java TransportConnector.java region/RegionBroker.java
Date Wed, 17 Mar 2010 16:17:26 GMT
Author: rajdavies
Date: Wed Mar 17 16:17:26 2010
New Revision: 924349

URL: http://svn.apache.org/viewvc?rev=924349&view=rev
Log:
added option to not update clients when broker removed from a cluster 

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/Connector.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/Connector.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/Connector.java?rev=924349&r1=924348&r2=924349&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/Connector.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/Connector.java Wed
Mar 17 16:17:26 2010
@@ -52,5 +52,11 @@ public interface Connector extends Servi
      * about the connected brokers in the cluster
      */
     public void updateClientClusterInfo();
+    
+    /**
+     * @return true if clients should be updated when
+     * a broker is removed from a broker
+     */
+    public boolean  isUpdateClusterClientsOnRemove();
 
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java?rev=924349&r1=924348&r2=924349&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java
Wed Mar 17 16:17:26 2010
@@ -67,8 +67,9 @@ public class TransportConnector implemen
     private boolean disableAsyncDispatch;
     private boolean enableStatusMonitor = false;
     private Broker broker;
-    private boolean updateClusterClients = false;
+    private boolean updateClusterClients = true;
     private boolean rebalanceClusterClients;
+    private boolean updateClusterClientsOnRemove = false;
     private String updateClusterFilter;
 
     public TransportConnector() {
@@ -509,8 +510,22 @@ public class TransportConnector implemen
     public void setRebalanceClusterClients(boolean rebalanceClusterClients) {
         this.rebalanceClusterClients = rebalanceClusterClients;
     }
+ 
+    /**
+     * @return the updateClusterClientsOnRemove
+     */
+    public boolean isUpdateClusterClientsOnRemove() {
+        return this.updateClusterClientsOnRemove;
+    }
 
     /**
+     * @param updateClusterClientsOnRemove the updateClusterClientsOnRemove to set
+     */
+    public void setUpdateClusterClientsOnRemove(boolean updateClusterClientsOnRemove) {
+        this.updateClusterClientsOnRemove = updateClusterClientsOnRemove;
+    }
+    
+    /**
      * @return the updateClusterFilter
      */
     public String getUpdateClusterFilter() {
@@ -524,4 +539,5 @@ public class TransportConnector implemen
     public void setUpdateClusterFilter(String updateClusterFilter) {
         this.updateClusterFilter = updateClusterFilter;
     }
+
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java?rev=924349&r1=924348&r2=924349&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java
Wed Mar 17 16:17:26 2010
@@ -587,14 +587,14 @@ public class RegionBroker extends EmptyB
     @Override
     public synchronized void addBroker(Connection connection, BrokerInfo info) {
         brokerInfos.add(info);
-        updateClients();
+        addBrokerInClusterUpdate();
     }
 
     @Override
     public synchronized void removeBroker(Connection connection, BrokerInfo info) {
         if (info != null) {
             brokerInfos.remove(info);
-            updateClients();
+            removeBrokerInClusterUpdate();
         }
     }
 
@@ -835,10 +835,21 @@ public class RegionBroker extends EmptyB
         }
     }
     
-    protected void updateClients() {
+    protected void addBrokerInClusterUpdate() {
         List<TransportConnector> connectors = this.brokerService.getTransportConnectors();
         for (TransportConnector connector : connectors) {
-            connector.updateClientClusterInfo();
+            if (connector.isUpdateClusterClients()) {
+                connector.updateClientClusterInfo();
+            }
+        }
+    }
+
+    protected void removeBrokerInClusterUpdate() {
+        List<TransportConnector> connectors = this.brokerService.getTransportConnectors();
+        for (TransportConnector connector : connectors) {
+            if (connector.isUpdateClusterClients() && connector.isUpdateClusterClientsOnRemove())
{
+                connector.updateClientClusterInfo();
+            }
         }
     }
 }



Mime
View raw message