activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-6322 - Introduce timeout in network bridge for waiting broker infos
Date Tue, 14 Jun 2016 12:29:21 GMT
Repository: activemq
Updated Branches:
  refs/heads/master dbed28e62 -> 9f9b0fb26


https://issues.apache.org/jira/browse/AMQ-6322 - Introduce timeout in network bridge for waiting
broker infos


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/9f9b0fb2
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/9f9b0fb2
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/9f9b0fb2

Branch: refs/heads/master
Commit: 9f9b0fb26afdec927f8a33bdb3dc8d9149eb18c2
Parents: dbed28e
Author: Dejan Bosanac <dejan@nighttale.net>
Authored: Tue Jun 14 14:29:11 2016 +0200
Committer: Dejan Bosanac <dejan@nighttale.net>
Committed: Tue Jun 14 14:29:11 2016 +0200

----------------------------------------------------------------------
 .../activemq/network/DemandForwardingBridgeSupport.java   | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/9f9b0fb2/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
b/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
index c1319f5..4df71d5 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
@@ -90,6 +90,7 @@ import org.apache.activemq.transport.Transport;
 import org.apache.activemq.transport.TransportDisposedIOException;
 import org.apache.activemq.transport.TransportFilter;
 import org.apache.activemq.transport.tcp.SslTransport;
+import org.apache.activemq.transport.tcp.TcpTransport;
 import org.apache.activemq.util.IdGenerator;
 import org.apache.activemq.util.IntrospectionSupport;
 import org.apache.activemq.util.LongSequenceGenerator;
@@ -342,11 +343,16 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge,
Br
     }
 
     private void collectBrokerInfos() {
+        int timeout = 30000;
+        TcpTransport tcpTransport = remoteBroker.narrow(TcpTransport.class);
+        if (tcpTransport != null) {
+           timeout = tcpTransport.getConnectionTimeout();
+        }
 
         // First wait for the remote to feed us its BrokerInfo, then we can check on
         // the LocalBrokerInfo and decide is this is a loop.
         try {
-            remoteBrokerInfo = futureRemoteBrokerInfo.get();
+            remoteBrokerInfo = futureRemoteBrokerInfo.get(timeout, TimeUnit.MILLISECONDS);
             if (remoteBrokerInfo == null) {
                 serviceLocalException(new Throwable("remoteBrokerInfo is null"));
                 return;
@@ -357,7 +363,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge,
Br
         }
 
         try {
-            localBrokerInfo = futureLocalBrokerInfo.get();
+            localBrokerInfo = futureLocalBrokerInfo.get(timeout, TimeUnit.MILLISECONDS);
             if (localBrokerInfo == null) {
                 serviceLocalException(new Throwable("localBrokerInfo is null"));
                 return;


Mime
View raw message