mirror of https://github.com/apache/activemq.git
added patch with addition of getter for link stealing enabled and a unit test.
This commit is contained in:
parent
9e139017e4
commit
d223ea979f
|
@ -66,4 +66,10 @@ public interface Connector extends Service {
|
||||||
* @return true/false if link stealing is enabled
|
* @return true/false if link stealing is enabled
|
||||||
*/
|
*/
|
||||||
boolean isAllowLinkStealing();
|
boolean isAllowLinkStealing();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The comma separated string of regex patterns to match
|
||||||
|
* broker names for cluster client updates
|
||||||
|
*/
|
||||||
|
String getUpdateClusterFilter();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ public class ConnectorView implements ConnectorViewMBean {
|
||||||
this.connector = connector;
|
this.connector = connector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void start() throws Exception {
|
public void start() throws Exception {
|
||||||
connector.start();
|
connector.start();
|
||||||
}
|
}
|
||||||
|
@ -35,6 +36,7 @@ public class ConnectorView implements ConnectorViewMBean {
|
||||||
return getBrokerInfo().getBrokerName();
|
return getBrokerInfo().getBrokerName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void stop() throws Exception {
|
public void stop() throws Exception {
|
||||||
connector.stop();
|
connector.stop();
|
||||||
}
|
}
|
||||||
|
@ -50,6 +52,7 @@ public class ConnectorView implements ConnectorViewMBean {
|
||||||
/**
|
/**
|
||||||
* Resets the statistics
|
* Resets the statistics
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void resetStatistics() {
|
public void resetStatistics() {
|
||||||
connector.getStatistics().reset();
|
connector.getStatistics().reset();
|
||||||
}
|
}
|
||||||
|
@ -57,6 +60,7 @@ public class ConnectorView implements ConnectorViewMBean {
|
||||||
/**
|
/**
|
||||||
* enable statistics gathering
|
* enable statistics gathering
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void enableStatistics() {
|
public void enableStatistics() {
|
||||||
connector.getStatistics().setEnabled(true);
|
connector.getStatistics().setEnabled(true);
|
||||||
}
|
}
|
||||||
|
@ -64,6 +68,7 @@ public class ConnectorView implements ConnectorViewMBean {
|
||||||
/**
|
/**
|
||||||
* disable statistics gathering
|
* disable statistics gathering
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void disableStatistics() {
|
public void disableStatistics() {
|
||||||
connector.getStatistics().setEnabled(false);
|
connector.getStatistics().setEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -73,6 +78,7 @@ public class ConnectorView implements ConnectorViewMBean {
|
||||||
*
|
*
|
||||||
* @return true if statistics is enabled
|
* @return true if statistics is enabled
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isStatisticsEnabled() {
|
public boolean isStatisticsEnabled() {
|
||||||
return connector.getStatistics().isEnabled();
|
return connector.getStatistics().isEnabled();
|
||||||
}
|
}
|
||||||
|
@ -80,8 +86,54 @@ public class ConnectorView implements ConnectorViewMBean {
|
||||||
/**
|
/**
|
||||||
* Returns the number of current connections
|
* Returns the number of current connections
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int connectionCount() {
|
public int connectionCount() {
|
||||||
return connector.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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,4 +49,39 @@ public interface ConnectorViewMBean extends Service {
|
||||||
@MBeanInfo("Statistics gathering enabled")
|
@MBeanInfo("Statistics gathering enabled")
|
||||||
boolean isStatisticsEnabled();
|
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();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1361,6 +1361,31 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
|
||||||
session.close();
|
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 {
|
public void testDynamicProducers() throws Exception {
|
||||||
connection = connectionFactory.createConnection();
|
connection = connectionFactory.createConnection();
|
||||||
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||||
|
|
Loading…
Reference in New Issue