activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1069846 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/TransportConnection.java test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java
Date Fri, 11 Feb 2011 15:42:38 GMT
Author: gtully
Date: Fri Feb 11 15:42:38 2011
New Revision: 1069846

URL: http://svn.apache.org/viewvc?rev=1069846&view=rev
Log:
http://issues.apache.org/jira/browse/AMQ-3178 - 5.3.x clients to 5.4 brokers always get updated
cluster information in the broker info, this should be configurable

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java?rev=1069846&r1=1069845&r2=1069846&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
Fri Feb 11 15:42:38 2011
@@ -887,7 +887,11 @@ public class TransportConnection impleme
                 transport.start();
                 active = true;
                 BrokerInfo info = connector.getBrokerInfo().copy();
-                info.setPeerBrokerInfos(this.broker.getPeerBrokerInfos());
+                if (connector.isUpdateClusterClients()) {
+                    info.setPeerBrokerInfos(this.broker.getPeerBrokerInfos());
+                } else {
+                    info.setPeerBrokerInfos(null);
+                }
                 dispatchAsync(info);
                 
                 connector.onStarted(this);

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java?rev=1069846&r1=1069845&r2=1069846&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/failover/FailoverTransportBrokerTest.java
Fri Feb 11 15:42:38 2011
@@ -16,7 +16,9 @@
  */
 package org.apache.activemq.transport.failover;
 
+import java.io.IOException;
 import java.net.URI;
+import java.util.concurrent.TimeUnit;
 
 import javax.jms.DeliveryMode;
 
@@ -26,6 +28,7 @@ import org.apache.activemq.broker.Transp
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQQueue;
 import org.apache.activemq.command.ActiveMQTopic;
+import org.apache.activemq.command.BrokerInfo;
 import org.apache.activemq.command.ConnectionInfo;
 import org.apache.activemq.command.ConsumerInfo;
 import org.apache.activemq.command.ProducerInfo;
@@ -33,6 +36,7 @@ import org.apache.activemq.command.Sessi
 import org.apache.activemq.network.NetworkTestSupport;
 import org.apache.activemq.transport.Transport;
 import org.apache.activemq.transport.TransportFactory;
+import org.apache.activemq.transport.TransportListener;
 import org.apache.activemq.transport.multicast.MulticastTransportTest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -113,6 +117,40 @@ public class FailoverTransportBrokerTest
 
     }
 
+    public void testNoBrokersInBrokerInfo() throws Exception {
+        final BrokerInfo info[] = new BrokerInfo[1];
+        StubConnection c = createFailoverConnection();
+        c.setListener(new TransportListener() {
+            @Override
+            public void onCommand(Object command) {
+                if (command instanceof BrokerInfo) {
+                    info[0] = (BrokerInfo) command;
+                }
+            }
+
+            @Override
+            public void onException(IOException error) {
+                //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            @Override
+            public void transportInterupted() {
+                //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            @Override
+            public void transportResumed() {
+                //To change body of implemented methods use File | Settings | File Templates.
+            }
+        });
+        c.start();
+        int count = 0;
+        while(count++ < 5 && info[0] == null) {
+            TimeUnit.SECONDS.sleep(1);
+        }
+        assertNull("no peer brokers present", info[0].getPeerBrokerInfos());
+    }
+
     protected String getLocalURI() {
         return "tcp://localhost:0?wireFormat.tcpNoDelayEnabled=true";
     }



Mime
View raw message