activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1032647 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java test/java/org/apache/activemq/usecases/BrowseOverNetworkTest.java
Date Mon, 08 Nov 2010 17:45:36 GMT
Author: dejanb
Date: Mon Nov  8 17:45:35 2010
New Revision: 1032647

URL: http://svn.apache.org/viewvc?rev=1032647&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQ-3020 - supress browsers over network

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/BrowseOverNetworkTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java?rev=1032647&r1=1032646&r2=1032647&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
Mon Nov  8 17:45:35 2010
@@ -566,9 +566,16 @@ public abstract class DemandForwardingBr
             ConsumerInfo info = (ConsumerInfo) data;
             BrokerId[] path = info.getBrokerPath();
 
+            if (info.isBrowser()) {
+                if (LOG.isDebugEnabled()) {
+                    LOG.info(configuration.getBrokerName() + " Ignoring sub from " + remoteBrokerName
+ ", browsers explicitly suppressed");
+                }
+                return;
+            }
+
             if (path != null && path.length >= networkTTL) {
                 if (LOG.isDebugEnabled()) {
-                    LOG.debug(configuration.getBrokerName() + " Ignoring sub  from " + remoteBrokerName
+ ", restricted to " + networkTTL + " network hops only : " + info);
+                    LOG.debug(configuration.getBrokerName() + " Ignoring sub from " + remoteBrokerName
+ ", restricted to " + networkTTL + " network hops only : " + info);
                 }
                 return;
             }

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/BrowseOverNetworkTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/BrowseOverNetworkTest.java?rev=1032647&r1=1032646&r2=1032647&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/BrowseOverNetworkTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/BrowseOverNetworkTest.java
Mon Nov  8 17:45:35 2010
@@ -51,23 +51,25 @@ public class BrowseOverNetworkTest exten
 
         sendMessages("BrokerA", dest, MESSAGE_COUNT);
 
-        browseMessages("BrokerB", dest);
+        Thread.sleep(1000);
+
+        int browsed = browseMessages("BrokerB", dest);
 
-        Thread.sleep(2000);
+        Thread.sleep(1000);
 
         MessageConsumer clientA = createConsumer("BrokerA", dest);
         MessageIdList msgsA = getConsumerMessages("BrokerA", clientA);
         msgsA.waitForMessagesToArrive(MESSAGE_COUNT);
 
-        Thread.sleep(2000);
+        Thread.sleep(1000);
         MessageConsumer clientB = createConsumer("BrokerB", dest);
         MessageIdList msgsB = getConsumerMessages("BrokerB", clientB);
         msgsB.waitForMessagesToArrive(MESSAGE_COUNT);
 
         LOG.info("A+B: " + msgsA.getMessageCount() + "+"
                 + msgsB.getMessageCount());
-        assertEquals(MESSAGE_COUNT, msgsA.getMessageCount()
-                + msgsB.getMessageCount());
+        assertEquals("Consumer on Broker A, should've consumed all messages", MESSAGE_COUNT,
msgsA.getMessageCount());
+        assertEquals("Broker B shouldn't get any messages", 0, browsed);
     }
 
     public void testConsumerInfo() throws Exception {
@@ -185,6 +187,7 @@ public class BrowseOverNetworkTest exten
         startAllBrokers();
 
         brokers.get("BrokerA").broker.waitUntilStarted();
+        brokers.get("BrokerB").broker.waitUntilStarted();
         brokers.get("BrokerC").broker.waitUntilStarted();
         brokers.get("BrokerD").broker.waitUntilStarted();
 



Mime
View raw message