mirror of https://github.com/apache/activemq.git
This commit is contained in:
parent
b7c430d068
commit
71e4585689
|
@ -51,6 +51,11 @@ public class NetworkBridgeView implements NetworkBridgeViewMBean {
|
||||||
return bridge.getRemoteBrokerName();
|
return bridge.getRemoteBrokerName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getRemoteBrokerId() {
|
||||||
|
return bridge.getRemoteBrokerId();
|
||||||
|
}
|
||||||
|
|
||||||
public String getLocalBrokerName() {
|
public String getLocalBrokerName() {
|
||||||
return bridge.getLocalBrokerName();
|
return bridge.getLocalBrokerName();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@ public interface NetworkBridgeViewMBean extends Service {
|
||||||
|
|
||||||
String getRemoteBrokerName();
|
String getRemoteBrokerName();
|
||||||
|
|
||||||
|
String getRemoteBrokerId();
|
||||||
|
|
||||||
String getLocalBrokerName();
|
String getLocalBrokerName();
|
||||||
|
|
||||||
long getEnqueueCounter();
|
long getEnqueueCounter();
|
||||||
|
|
|
@ -1498,6 +1498,11 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
|
||||||
return remoteBrokerInfo == null ? null : remoteBrokerInfo.getBrokerName();
|
return remoteBrokerInfo == null ? null : remoteBrokerInfo.getBrokerName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRemoteBrokerId() {
|
||||||
|
return (remoteBrokerInfo == null || remoteBrokerInfo.getBrokerId() ==null)? null : remoteBrokerInfo.getBrokerId().toString();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLocalBrokerName() {
|
public String getLocalBrokerName() {
|
||||||
return localBrokerInfo == null ? null : localBrokerInfo.getBrokerName();
|
return localBrokerInfo == null ? null : localBrokerInfo.getBrokerName();
|
||||||
|
|
|
@ -53,6 +53,11 @@ public interface NetworkBridge extends Service {
|
||||||
*/
|
*/
|
||||||
String getRemoteBrokerName();
|
String getRemoteBrokerName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the id of the remote broker this bridge is connected to.
|
||||||
|
*/
|
||||||
|
String getRemoteBrokerId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the network address of the local broker connection.
|
* @return the network address of the local broker connection.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -18,6 +18,8 @@ package org.apache.activemq;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
import java.security.AccessController;
|
||||||
|
import java.security.PrivilegedAction;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -32,7 +34,6 @@ import javax.jms.QueueConnectionFactory;
|
||||||
import javax.jms.TopicConnection;
|
import javax.jms.TopicConnection;
|
||||||
import javax.jms.TopicConnectionFactory;
|
import javax.jms.TopicConnectionFactory;
|
||||||
import javax.naming.Context;
|
import javax.naming.Context;
|
||||||
|
|
||||||
import org.apache.activemq.blob.BlobTransferPolicy;
|
import org.apache.activemq.blob.BlobTransferPolicy;
|
||||||
import org.apache.activemq.broker.region.policy.RedeliveryPolicyMap;
|
import org.apache.activemq.broker.region.policy.RedeliveryPolicyMap;
|
||||||
import org.apache.activemq.jndi.JNDIBaseStorable;
|
import org.apache.activemq.jndi.JNDIBaseStorable;
|
||||||
|
@ -48,6 +49,8 @@ import org.apache.activemq.util.IntrospectionSupport;
|
||||||
import org.apache.activemq.util.JMSExceptionSupport;
|
import org.apache.activemq.util.JMSExceptionSupport;
|
||||||
import org.apache.activemq.util.URISupport;
|
import org.apache.activemq.util.URISupport;
|
||||||
import org.apache.activemq.util.URISupport.CompositeData;
|
import org.apache.activemq.util.URISupport.CompositeData;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A ConnectionFactory is an an Administered object, and is used for creating
|
* A ConnectionFactory is an an Administered object, and is used for creating
|
||||||
|
@ -59,8 +62,61 @@ import org.apache.activemq.util.URISupport.CompositeData;
|
||||||
* @see javax.jms.ConnectionFactory
|
* @see javax.jms.ConnectionFactory
|
||||||
*/
|
*/
|
||||||
public class ActiveMQConnectionFactory extends JNDIBaseStorable implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory, StatsCapable, Cloneable {
|
public class ActiveMQConnectionFactory extends JNDIBaseStorable implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory, StatsCapable, Cloneable {
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(ActiveMQConnectionFactory.class);
|
||||||
|
private static final String DEFAULT_BROKER_HOST;
|
||||||
|
private static final int DEFAULT_BROKER_PORT;
|
||||||
|
static{
|
||||||
|
String host = null;
|
||||||
|
String port = null;
|
||||||
|
try {
|
||||||
|
host = AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||||
|
@Override
|
||||||
|
public String run() {
|
||||||
|
String result = System.getProperty("org.apache.activemq.AMQ_HOST");
|
||||||
|
result = (result==null||result.isEmpty()) ? System.getProperty("AMQ_HOST","localhost") : result;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
port = AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||||
|
@Override
|
||||||
|
public String run() {
|
||||||
|
String result = System.getProperty("org.apache.activemq.AMQ_PORT");
|
||||||
|
result = (result==null||result.isEmpty()) ? System.getProperty("AMQ_PORT","61616") : result;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}catch(Throwable e){
|
||||||
|
LOG.debug("Failed to look up System properties for host and port",e);
|
||||||
|
}
|
||||||
|
host = (host == null || host.isEmpty()) ? "localhost" : host;
|
||||||
|
port = (port == null || port.isEmpty()) ? "61616" : port;
|
||||||
|
DEFAULT_BROKER_HOST = host;
|
||||||
|
DEFAULT_BROKER_PORT = Integer.parseInt(port);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static final String DEFAULT_BROKER_BIND_URL;
|
||||||
|
|
||||||
|
static{
|
||||||
|
final String defaultURL = "tcp://" + DEFAULT_BROKER_HOST + ":" + DEFAULT_BROKER_PORT;
|
||||||
|
String bindURL = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
bindURL = AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||||
|
@Override
|
||||||
|
public String run() {
|
||||||
|
String result = System.getProperty("org.apache.activemq.BROKER_BIND_URL");
|
||||||
|
result = (result==null||result.isEmpty()) ? System.getProperty("BROKER_BIND_URL",defaultURL) : result;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}catch(Throwable e){
|
||||||
|
LOG.debug("Failed to look up System properties for host and port",e);
|
||||||
|
}
|
||||||
|
bindURL = (bindURL == null || bindURL.isEmpty()) ? defaultURL : bindURL;
|
||||||
|
DEFAULT_BROKER_BIND_URL = bindURL;
|
||||||
|
}
|
||||||
|
|
||||||
public static final String DEFAULT_BROKER_BIND_URL = "tcp://localhost:61616";
|
|
||||||
public static final String DEFAULT_BROKER_URL = "failover://"+DEFAULT_BROKER_BIND_URL;
|
public static final String DEFAULT_BROKER_URL = "failover://"+DEFAULT_BROKER_BIND_URL;
|
||||||
public static final String DEFAULT_USER = null;
|
public static final String DEFAULT_USER = null;
|
||||||
public static final String DEFAULT_PASSWORD = null;
|
public static final String DEFAULT_PASSWORD = null;
|
||||||
|
|
|
@ -302,6 +302,11 @@ public class AMQ4160Test extends JmsMultipleBrokersTestSupport {
|
||||||
return next.getRemoteBrokerName();
|
return next.getRemoteBrokerName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRemoteBrokerId() {
|
||||||
|
return next.getRemoteBrokerId();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLocalAddress() {
|
public String getLocalAddress() {
|
||||||
return next.getLocalAddress();
|
return next.getLocalAddress();
|
||||||
|
|
Loading…
Reference in New Issue