Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 62419 invoked from network); 22 Sep 2010 13:05:41 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 22 Sep 2010 13:05:41 -0000 Received: (qmail 45207 invoked by uid 500); 22 Sep 2010 13:05:41 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 45138 invoked by uid 500); 22 Sep 2010 13:05:39 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 45126 invoked by uid 99); 22 Sep 2010 13:05:38 -0000 Received: from Unknown (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Sep 2010 13:05:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Sep 2010 13:05:20 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 915D823888EC; Wed, 22 Sep 2010 13:04:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@activemq.apache.org From: dejanb@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100922130459.915D823888EC@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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();