activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1244221 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq: broker/TransportConnector.java transport/failover/FailoverTransport.java
Date Tue, 14 Feb 2012 21:36:04 GMT
Author: tabish
Date: Tue Feb 14 21:36:04 2012
New Revision: 1244221

URL: http://svn.apache.org/viewvc?rev=1244221&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3706

Don't send a URI to the client that equals "null" when the BrokerInfo has no set Broker URI,
that sends the failover transport into an infinite reconnect cycle.

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java?rev=1244221&r1=1244220&r2=1244221&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java
Tue Feb 14 21:36:04 2012
@@ -16,6 +16,19 @@
  */
 package org.apache.activemq.broker;
 
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Random;
+import java.util.StringTokenizer;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.regex.Pattern;
+
+import javax.management.ObjectName;
+
 import org.apache.activemq.broker.jmx.ManagedTransportConnector;
 import org.apache.activemq.broker.jmx.ManagementContext;
 import org.apache.activemq.broker.region.ConnectorStatistics;
@@ -35,18 +48,6 @@ import org.apache.activemq.util.ServiceS
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.management.ObjectName;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Random;
-import java.util.StringTokenizer;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.regex.Pattern;
-
 /**
  * @org.apache.xbean.XBean
  *
@@ -262,7 +263,7 @@ public class TransportConnector implemen
 
         LOG.info("Connector " + getName() + " Started");
     }
-    
+
     public String getPublishableConnectString() throws Exception {
         return getPublishableConnectString(getConnectUri());
     }
@@ -413,7 +414,9 @@ public class TransportConnector implemen
             uris.add(brokerService.getDefaultSocketURIString());
             for (BrokerInfo info: broker.getPeerBrokerInfos()) {
                 if (isMatchesClusterFilter(info.getBrokerName())) {
-                    uris.add(info.getBrokerURL());
+                    if (info.getBrokerURL() != null) {
+                        uris.add(info.getBrokerURL());
+                    }
                 }
             }
             if (rebalance) {
@@ -423,7 +426,7 @@ public class TransportConnector implemen
                 connectedBrokers += separator + uri;
                 separator = ",";
             }
-            
+
         }
         ConnectionControl control = new ConnectionControl();
         control.setConnectedBrokers(connectedBrokers);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java?rev=1244221&r1=1244220&r2=1244221&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
Tue Feb 14 21:36:04 2012
@@ -16,6 +16,26 @@
  */
 package org.apache.activemq.transport.failover;
 
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.InterruptedIOException;
+import java.net.InetAddress;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.atomic.AtomicReference;
+
 import org.apache.activemq.broker.SslContext;
 import org.apache.activemq.command.Command;
 import org.apache.activemq.command.ConnectionControl;
@@ -39,26 +59,6 @@ import org.apache.activemq.util.ServiceS
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.InterruptedIOException;
-import java.net.InetAddress;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.atomic.AtomicReference;
-
 /**
  * A Transport that is made reliable by being able to fail over to another
  * transport when a transport failure is detected.
@@ -711,7 +711,7 @@ public class FailoverTransport implement
                 if (removed) {
                     updated.add(failedConnectTransportURI);
                 }
-            }            
+            }
             return updated;
         }
         ArrayList<URI> l = new ArrayList<URI>(uris);
@@ -889,7 +889,7 @@ public class FailoverTransport implement
                     // If we have a backup already waiting lets try it.
                     synchronized (backupMutex) {
                         if ((priorityBackup || backup) && !backups.isEmpty()) {
-                            ArrayList<BackupTransport> l = new ArrayList(backups);
+                            ArrayList<BackupTransport> l = new ArrayList<BackupTransport>(backups);
                             if (randomize) {
                                 Collections.shuffle(l);
                             }
@@ -1134,7 +1134,7 @@ public class FailoverTransport implement
         }
         return false;
     }
-    
+
     protected boolean isPriority(URI uri) {
         if (!priorityList.isEmpty()) {
             return priorityList.contains(uri);
@@ -1180,7 +1180,7 @@ public class FailoverTransport implement
                         updated.add(uri);
                     }
                 }
-                if (!(copy.isEmpty() && updated.isEmpty()) && !copy.equals(new
HashSet(updated))) {
+                if (!(copy.isEmpty() && updated.isEmpty()) && !copy.equals(new
HashSet<URI>(updated))) {
                     buildBackups();
                     synchronized (reconnectMutex) {
                         reconnect(rebalance);



Mime
View raw message