mirror of https://github.com/apache/activemq.git
added option to not update clients when broker removed from a cluster
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@924349 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8329c53c21
commit
be55d0a661
|
@ -53,4 +53,10 @@ public interface Connector extends Service {
|
|||
*/
|
||||
public void updateClientClusterInfo();
|
||||
|
||||
/**
|
||||
* @return true if clients should be updated when
|
||||
* a broker is removed from a broker
|
||||
*/
|
||||
public boolean isUpdateClusterClientsOnRemove();
|
||||
|
||||
}
|
||||
|
|
|
@ -67,8 +67,9 @@ public class TransportConnector implements Connector, BrokerServiceAware {
|
|||
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() {
|
||||
|
@ -510,6 +511,20 @@ public class TransportConnector implements Connector, BrokerServiceAware {
|
|||
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
|
||||
*/
|
||||
|
@ -524,4 +539,5 @@ public class TransportConnector implements Connector, BrokerServiceAware {
|
|||
public void setUpdateClusterFilter(String updateClusterFilter) {
|
||||
this.updateClusterFilter = updateClusterFilter;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -587,14 +587,14 @@ public class RegionBroker extends EmptyBroker {
|
|||
@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 EmptyBroker {
|
|||
}
|
||||
}
|
||||
|
||||
protected void updateClients() {
|
||||
protected void addBrokerInClusterUpdate() {
|
||||
List<TransportConnector> connectors = this.brokerService.getTransportConnectors();
|
||||
for (TransportConnector connector : connectors) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue