From 9c12a0c9b8f806843c1175e9b63505c66c582c87 Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Thu, 10 Jul 2008 09:27:09 +0000 Subject: [PATCH] Fix for https://issues.apache.org/activemq/browse/AMQ-1848 git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@675484 13f79535-47bb-0310-9956-ffa450edef68 --- .../network/DemandForwardingBridgeSupport.java | 11 ++++++++--- .../activemq/network/DuplexNetworkMBeanTest.java | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java b/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java index 26767467ae..5704aa26ac 100644 --- a/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java +++ b/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java @@ -431,10 +431,15 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge { break; case ConsumerInfo.DATA_STRUCTURE_TYPE: localStartedLatch.await(); - if (!addConsumerInfo((ConsumerInfo)command)) { - if (LOG.isDebugEnabled()) { - LOG.debug("Ignoring ConsumerInfo: " + command); + if (started.get()) { + if (!addConsumerInfo((ConsumerInfo) command)) { + if (LOG.isDebugEnabled()) { + LOG.debug("Ignoring ConsumerInfo: "+ command); + } } + } else { + // received a subscription whilst stopping + LOG.warn("Stopping - ignoring ConsumerInfo: "+ command); } break; default: diff --git a/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkMBeanTest.java b/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkMBeanTest.java index c08f3848f3..c56b03a774 100644 --- a/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkMBeanTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/network/DuplexNetworkMBeanTest.java @@ -34,7 +34,7 @@ import org.apache.commons.logging.LogFactory; public class DuplexNetworkMBeanTest extends TestCase { protected static final Log LOG = LogFactory.getLog(DuplexNetworkMBeanTest.class); - protected final int numRestarts = 2; + protected final int numRestarts = 10; protected BrokerService createBroker() throws Exception { BrokerService broker = new BrokerService(); @@ -48,7 +48,7 @@ public class DuplexNetworkMBeanTest extends TestCase { BrokerService broker = new BrokerService(); broker.setBrokerName("networkedBroker"); broker.addConnector("tcp://localhost:62617"); - NetworkConnector networkConnector = broker.addNetworkConnector("static://tcp://localhost:61617"); + NetworkConnector networkConnector = broker.addNetworkConnector("static:(tcp://localhost:61617)?maxReconnectDelay=1000&useExponentialBackOff=false"); networkConnector.setDuplex(true); return broker; } @@ -87,7 +87,7 @@ public class DuplexNetworkMBeanTest extends TestCase { for (int i=0; i