From 0945e32b6ac01569d69300c80c344bfae8392cbf Mon Sep 17 00:00:00 2001 From: "Hiram R. Chirino" Date: Wed, 8 Aug 2007 13:22:15 +0000 Subject: [PATCH] Fix the TopicMasterSlaveTest that was failing - Stack was overflowing due to the advisory broker advising on topic advisories - MasterConnector now makes sync request to the slave if it's given a sync request - Test was failing due to kaha not being able to create a file that was too long.. fixed by making the sub name and client id and dest name shorter. Need to revisit. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@563854 13f79535-47bb-0310-9956-ffa450edef68 --- .../activemq/advisory/AdvisoryBroker.java | 19 +++++++++++-------- .../apache/activemq/broker/BrokerService.java | 2 +- .../activemq/broker/ft/MasterConnector.java | 5 +++-- .../activemq/JmsSendReceiveTestSupport.java | 4 ++-- .../java/org/apache/activemq/TestSupport.java | 2 +- .../broker/ft/TopicMasterSlaveTest.java | 4 ++-- 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java b/activemq-core/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java index ef2e33fc38..a6d49484fb 100755 --- a/activemq-core/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java +++ b/activemq-core/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java @@ -145,11 +145,12 @@ public class AdvisoryBroker extends BrokerFilter { public Destination addDestination(ConnectionContext context, ActiveMQDestination destination) throws Exception { Destination answer = next.addDestination(context, destination); - - ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(destination); - DestinationInfo info = new DestinationInfo(context.getConnectionId(), DestinationInfo.ADD_OPERATION_TYPE, destination); - fireAdvisory(context, topic, info); - destinations.put(destination, info); + if( !AdvisorySupport.isAdvisoryTopic(destination) ) { + ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(destination); + DestinationInfo info = new DestinationInfo(context.getConnectionId(), DestinationInfo.ADD_OPERATION_TYPE, destination); + fireAdvisory(context, topic, info); + destinations.put(destination, info); + } return answer; } @@ -157,9 +158,11 @@ public class AdvisoryBroker extends BrokerFilter { ActiveMQDestination destination = info.getDestination(); next.addDestinationInfo(context, info); - ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(destination); - fireAdvisory(context, topic, info); - destinations.put(destination, info); + if( !AdvisorySupport.isAdvisoryTopic(destination) ) { + ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(destination); + fireAdvisory(context, topic, info); + destinations.put(destination, info); + } } public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception { diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java index f4187a0b1b..9ff9daecca 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java @@ -1367,12 +1367,12 @@ public class BrokerService implements Service { // Add a filter that will stop access to the broker once stopped broker = new MutableBrokerFilter(broker) { public void stop() throws Exception { - super.stop(); setNext(new ErrorBroker("Broker has been stopped: "+this) { // Just ignore additional stop actions. public void stop() throws Exception { } }); + super.stop(); } }; diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterConnector.java b/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterConnector.java index 8ec9d19abe..b1a042b42d 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterConnector.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterConnector.java @@ -222,11 +222,12 @@ public class MasterConnector implements Service,BrokerServiceAware{ }else{ boolean responseRequired=command.isResponseRequired(); int commandId=command.getCommandId(); - localBroker.oneway(command); if(responseRequired){ - Response response=new Response(); + Response response = (Response)localBroker.request(command); response.setCorrelationId(commandId); remoteBroker.oneway(response); + } else { + localBroker.oneway(command); } } }catch(IOException e){ diff --git a/activemq-core/src/test/java/org/apache/activemq/JmsSendReceiveTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/JmsSendReceiveTestSupport.java index 4189c588a9..23b81ae4e6 100755 --- a/activemq-core/src/test/java/org/apache/activemq/JmsSendReceiveTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/JmsSendReceiveTestSupport.java @@ -126,8 +126,8 @@ public class JmsSendReceiveTestSupport extends TestSupport implements MessageLis if (data.length != copyOfMessages.size()) { for (Iterator iter = copyOfMessages.iterator(); iter.hasNext();) { TextMessage message = (TextMessage) iter.next(); - if (log.isDebugEnabled()) { - log.info("<== " + counter++ + " = " + message); + if (log.isInfoEnabled()) { + log.info("<== " + counter++ + " = " + message.getText()); } } } diff --git a/activemq-core/src/test/java/org/apache/activemq/TestSupport.java b/activemq-core/src/test/java/org/apache/activemq/TestSupport.java index dce7b56bb7..1f0f9b4ca5 100755 --- a/activemq-core/src/test/java/org/apache/activemq/TestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/TestSupport.java @@ -122,7 +122,7 @@ public class TestSupport extends TestCase { } protected String getSubject() { - return getClass().getName() + "." + getName(); + return getName(); } diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/ft/TopicMasterSlaveTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/ft/TopicMasterSlaveTest.java index bd03d9fb28..3d3f050f46 100644 --- a/activemq-core/src/test/java/org/apache/activemq/broker/ft/TopicMasterSlaveTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/ft/TopicMasterSlaveTest.java @@ -34,12 +34,12 @@ public class TopicMasterSlaveTest extends QueueMasterSlaveTest{ } protected MessageConsumer createConsumer(Session session,Destination dest) throws JMSException{ - return session.createDurableSubscriber((Topic) dest,dest.toString()); + return session.createDurableSubscriber((Topic) dest,"subName"); } protected Connection createReceiveConnection() throws Exception{ Connection result=super.createReceiveConnection(); - result.setClientID(getClass().getName()); + result.setClientID("clientId"); return result; } }