mirror of https://github.com/apache/activemq.git
pretty print the local transport uri
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@553095 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4757541f96
commit
94f3e17d7b
|
@ -57,68 +57,55 @@ public class DiscoveryNetworkConnector extends NetworkConnector implements Disco
|
||||||
setDiscoveryAgent(DiscoveryAgentFactory.createDiscoveryAgent(discoveryURI));
|
setDiscoveryAgent(DiscoveryAgentFactory.createDiscoveryAgent(discoveryURI));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onServiceAdd(DiscoveryEvent event) {
|
public void onServiceAdd(DiscoveryEvent event){
|
||||||
|
String localURIName=localURI.getScheme() + "://" + localURI.getHost();
|
||||||
// Ignore events once we start stopping.
|
// Ignore events once we start stopping.
|
||||||
if( serviceSupport.isStopped() || serviceSupport.isStopping() )
|
if(serviceSupport.isStopped()||serviceSupport.isStopping())
|
||||||
return;
|
return;
|
||||||
|
String url=event.getServiceName();
|
||||||
String url = event.getServiceName();
|
if(url!=null){
|
||||||
if (url != null) {
|
|
||||||
|
|
||||||
URI uri;
|
URI uri;
|
||||||
try {
|
try{
|
||||||
uri = new URI(url);
|
uri=new URI(url);
|
||||||
}
|
}catch(URISyntaxException e){
|
||||||
catch (URISyntaxException e) {
|
log.warn("Could not connect to remote URI: "+url+" due to bad URI syntax: "+e,e);
|
||||||
log.warn("Could not connect to remote URI: " + url + " due to bad URI syntax: " + e, e);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should we try to connect to that URI?
|
// Should we try to connect to that URI?
|
||||||
if ( bridges.containsKey(uri)
|
if(bridges.containsKey(uri)||localURI.equals(uri)
|
||||||
|| localURI.equals(uri)
|
||(connectionFilter!=null&&!connectionFilter.connectTo(uri)))
|
||||||
|| (connectionFilter!=null && !connectionFilter.connectTo(uri))
|
|
||||||
)
|
|
||||||
return;
|
return;
|
||||||
|
URI connectUri=uri;
|
||||||
URI connectUri = uri;
|
log.info("Establishing network connection between from "+localURIName+" to "+connectUri);
|
||||||
log.info("Establishing network connection between from " + localURI + " to " + connectUri);
|
|
||||||
Transport remoteTransport;
|
Transport remoteTransport;
|
||||||
try {
|
try{
|
||||||
remoteTransport = TransportFactory.connect(connectUri);
|
remoteTransport=TransportFactory.connect(connectUri);
|
||||||
}
|
}catch(Exception e){
|
||||||
catch (Exception e) {
|
log.warn("Could not connect to remote URI: "+localURIName+": "+e.getMessage());
|
||||||
log.warn("Could not connect to remote URI: " + localURI + ": " + e.getMessage());
|
log.debug("Connection failure exception: "+e,e);
|
||||||
log.debug("Connection failure exception: "+ e, e);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Transport localTransport;
|
Transport localTransport;
|
||||||
try {
|
try{
|
||||||
localTransport = createLocalTransport();
|
localTransport=createLocalTransport();
|
||||||
}
|
}catch(Exception e){
|
||||||
catch (Exception e) {
|
|
||||||
ServiceSupport.dispose(remoteTransport);
|
ServiceSupport.dispose(remoteTransport);
|
||||||
log.warn("Could not connect to local URI: " + localURI + ": " + e.getMessage());
|
log.warn("Could not connect to local URI: "+localURIName+": "+e.getMessage());
|
||||||
log.debug("Connection failure exception: "+ e, e);
|
log.debug("Connection failure exception: "+e,e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
NetworkBridge bridge=createBridge(localTransport,remoteTransport,event);
|
||||||
NetworkBridge bridge = createBridge(localTransport, remoteTransport, event);
|
bridges.put(uri,bridge);
|
||||||
bridges.put(uri, bridge);
|
try{
|
||||||
try {
|
|
||||||
bridge.start();
|
bridge.start();
|
||||||
}
|
}catch(Exception e){
|
||||||
catch (Exception e) {
|
|
||||||
ServiceSupport.dispose(localTransport);
|
ServiceSupport.dispose(localTransport);
|
||||||
ServiceSupport.dispose(remoteTransport);
|
ServiceSupport.dispose(remoteTransport);
|
||||||
log.warn("Could not start network bridge between: " + localURI + " and: " + uri + " due to: " + e);
|
log.warn("Could not start network bridge between: "+localURIName+" and: "+uri+" due to: "+e);
|
||||||
log.debug("Start failure exception: "+ e, e);
|
log.debug("Start failure exception: "+e,e);
|
||||||
|
try{
|
||||||
try {
|
|
||||||
discoveryAgent.serviceFailed(event);
|
discoveryAgent.serviceFailed(event);
|
||||||
} catch (IOException e1) {
|
}catch(IOException e1){
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue