From a02fd05f57fafe250c49b032039add7673d9c11d Mon Sep 17 00:00:00 2001 From: "Hiram R. Chirino" Date: Thu, 7 Sep 2006 19:37:04 +0000 Subject: [PATCH] https://issues.apache.org/activemq/browse/AMQ-886 git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/branches/activemq-4.0@441189 13f79535-47bb-0310-9956-ffa450edef68 --- .../activemq/network/CompositeDemandForwardingBridge.java | 1 + .../org/apache/activemq/network/DemandForwardingBridge.java | 1 + .../activemq/network/DemandForwardingBridgeSupport.java | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/activemq-core/src/main/java/org/apache/activemq/network/CompositeDemandForwardingBridge.java b/activemq-core/src/main/java/org/apache/activemq/network/CompositeDemandForwardingBridge.java index bf7fa328ad..1d2c563d48 100644 --- a/activemq-core/src/main/java/org/apache/activemq/network/CompositeDemandForwardingBridge.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/CompositeDemandForwardingBridge.java @@ -44,6 +44,7 @@ public class CompositeDemandForwardingBridge extends DemandForwardingBridgeSuppo public CompositeDemandForwardingBridge(Transport localBroker, Transport remoteBroker) { super(localBroker, remoteBroker); remoteBrokerName = remoteBroker.toString(); + remoteBrokerNameKnownLatch.countDown(); } protected void serviceRemoteBrokerInfo(Command command) throws IOException { diff --git a/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridge.java b/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridge.java index ccd35cd65b..95a7eca6aa 100755 --- a/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridge.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridge.java @@ -57,6 +57,7 @@ public class DemandForwardingBridge extends DemandForwardingBridgeSupport { ServiceSupport.dispose(this); } } + remoteBrokerNameKnownLatch.countDown(); } } diff --git a/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java b/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java index 5407abc159..62346abbe0 100644 --- a/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java @@ -100,6 +100,7 @@ public abstract class DemandForwardingBridgeSupport implements Bridge { protected final ConcurrentHashMap subscriptionMapByRemoteId = new ConcurrentHashMap(); protected final BrokerId localBrokerPath[] = new BrokerId[] { null }; protected CountDownLatch startedLatch = new CountDownLatch(2); + protected CountDownLatch remoteBrokerNameKnownLatch = new CountDownLatch(1); protected boolean decreaseNetworkConsumerPriority; protected int networkTTL = 1; protected final AtomicBoolean remoteInterupted = new AtomicBoolean(false); @@ -212,6 +213,9 @@ public abstract class DemandForwardingBridgeSupport implements Bridge { protected void startLocalBridge() throws Exception { if(localBridgeStarted.compareAndSet(false,true)){ synchronized( this ) { + + remoteBrokerNameKnownLatch.await(); + localConnectionInfo=new ConnectionInfo(); localConnectionInfo.setConnectionId(new ConnectionId(idGenerator.generateId())); localClientId="NC_"+remoteBrokerName+"_inbound"+name;