activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r999924 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/BrokerService.java test/java/org/apache/activemq/usecases/AMQ2927Test.java
Date Wed, 22 Sep 2010 13:04:59 GMT
Author: dejanb
Date: Wed Sep 22 13:04:59 2010
New Revision: 999924

URL: http://svn.apache.org/viewvc?rev=999924&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQ-2927 - support for configuring custom broker
id

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQ2927Test.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=999924&r1=999923&r2=999924&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Wed Sep 22 13:04:59 2010
@@ -522,7 +522,9 @@ public class BrokerService implements Se
                     registerFTConnectorMBean(masterConnector);
                 }
             }
-            brokerId = broker.getBrokerId();
+            if (brokerId == null) {
+                brokerId = broker.getBrokerId();
+            }
             if (ioExceptionHandler == null) {
             	setIoExceptionHandler(new DefaultIOExceptionHandler());
             }
@@ -1820,6 +1822,9 @@ public class BrokerService implements Se
         regionBroker.setKeepDurableSubsActive(keepDurableSubsActive);
         regionBroker.setBrokerName(getBrokerName());
         regionBroker.getDestinationStatistics().setEnabled(enableStatistics);
+        if (brokerId != null) {
+            regionBroker.setBrokerId(brokerId);
+        }
         return regionBroker;
     }
 
@@ -2345,6 +2350,9 @@ public class BrokerService implements Se
 
     public void setBrokerContext(BrokerContext brokerContext) {
         this.brokerContext = brokerContext;
-    }    
+    }
 
+    public void setBrokerId(String brokerId) {
+        this.brokerId = new BrokerId(brokerId);
+    }
 }

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQ2927Test.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQ2927Test.java?rev=999924&r1=999923&r2=999924&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQ2927Test.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/AMQ2927Test.java
Wed Sep 22 13:04:59 2010
@@ -39,8 +39,10 @@ public class AMQ2927Test extends JmsMult
     public void setUp() throws Exception {
         super.setAutoFail(true);
         super.setUp();
-        createBroker(new URI("broker:(tcp://localhost:61616)/BrokerA?persistent=true&useJmx=false&deleteAllMessagesOnStartup=true"));
-        createBroker(new URI("broker:(tcp://localhost:61617)/BrokerB?persistent=true&useJmx=false"));
+        BrokerService brokerA = createBroker(new URI("broker:(tcp://localhost:61616)/BrokerA?persistent=true&useJmx=false&deleteAllMessagesOnStartup=true"));
+        brokerA.setBrokerId("BrokerA");
+        BrokerService brokerB = createBroker(new URI("broker:(tcp://localhost:61617)/BrokerB?persistent=true&useJmx=false&deleteAllMessagesOnStartup=true"));
+        brokerB.setBrokerId("BrokerB");
         NetworkConnector aTOb = bridgeBrokers(brokers.get("BrokerA").broker, brokers.get("BrokerB").broker,
false, 2, true, true);
         aTOb.addStaticallyIncludedDestination(queue);
         NetworkConnector bTOa = bridgeBrokers(brokers.get("BrokerB").broker, brokers.get("BrokerA").broker,
false, 2, true, true);
@@ -122,6 +124,7 @@ public class AMQ2927Test extends JmsMult
     protected void restartBroker(String brokerName) throws Exception {
         destroyBroker("BrokerA");
         BrokerService broker = createBroker(new URI("broker:(tcp://localhost:61616)/BrokerA?persistent=true&useJmx=false"));
+        broker.setBrokerId("BrokerA");
         NetworkConnector aTOb = bridgeBrokers(brokers.get("BrokerA").broker, brokers.get("BrokerB").broker,
false, 2, true, true);
         aTOb.addStaticallyIncludedDestination(queue);
         broker.start();



Mime
View raw message