mirror of
https://github.com/apache/activemq.git
synced 2025-02-17 07:24:51 +00:00
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();
|
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 disableAsyncDispatch;
|
||||||
private boolean enableStatusMonitor = false;
|
private boolean enableStatusMonitor = false;
|
||||||
private Broker broker;
|
private Broker broker;
|
||||||
private boolean updateClusterClients = false;
|
private boolean updateClusterClients = true;
|
||||||
private boolean rebalanceClusterClients;
|
private boolean rebalanceClusterClients;
|
||||||
|
private boolean updateClusterClientsOnRemove = false;
|
||||||
private String updateClusterFilter;
|
private String updateClusterFilter;
|
||||||
|
|
||||||
public TransportConnector() {
|
public TransportConnector() {
|
||||||
@ -510,6 +511,20 @@ public class TransportConnector implements Connector, BrokerServiceAware {
|
|||||||
this.rebalanceClusterClients = 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
|
* @return the updateClusterFilter
|
||||||
*/
|
*/
|
||||||
@ -524,4 +539,5 @@ public class TransportConnector implements Connector, BrokerServiceAware {
|
|||||||
public void setUpdateClusterFilter(String updateClusterFilter) {
|
public void setUpdateClusterFilter(String updateClusterFilter) {
|
||||||
this.updateClusterFilter = updateClusterFilter;
|
this.updateClusterFilter = updateClusterFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -587,14 +587,14 @@ public class RegionBroker extends EmptyBroker {
|
|||||||
@Override
|
@Override
|
||||||
public synchronized void addBroker(Connection connection, BrokerInfo info) {
|
public synchronized void addBroker(Connection connection, BrokerInfo info) {
|
||||||
brokerInfos.add(info);
|
brokerInfos.add(info);
|
||||||
updateClients();
|
addBrokerInClusterUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void removeBroker(Connection connection, BrokerInfo info) {
|
public synchronized void removeBroker(Connection connection, BrokerInfo info) {
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
brokerInfos.remove(info);
|
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();
|
List<TransportConnector> connectors = this.brokerService.getTransportConnectors();
|
||||||
for (TransportConnector connector : connectors) {
|
for (TransportConnector connector : connectors) {
|
||||||
|
if (connector.isUpdateClusterClients()) {
|
||||||
connector.updateClientClusterInfo();
|
connector.updateClientClusterInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void removeBrokerInClusterUpdate() {
|
||||||
|
List<TransportConnector> connectors = this.brokerService.getTransportConnectors();
|
||||||
|
for (TransportConnector connector : connectors) {
|
||||||
|
if (connector.isUpdateClusterClients() && connector.isUpdateClusterClientsOnRemove()) {
|
||||||
|
connector.updateClientClusterInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user