remove duplicate code removing advisories, handled cleanly in advisory broker already, additional load on destination map. Only on remove dest opts through, so impact is mostly small. better all the same. may lead to reduction in acces modes for the destination map

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1209058 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2011-12-01 12:48:51 +00:00
parent 3b7507f6b7
commit 6590d4b3d0
1 changed files with 0 additions and 24 deletions

View File

@ -30,7 +30,6 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
import javax.jms.InvalidClientIDException; import javax.jms.InvalidClientIDException;
import javax.jms.JMSException; import javax.jms.JMSException;
import org.apache.activemq.advisory.AdvisorySupport;
import org.apache.activemq.broker.Broker; import org.apache.activemq.broker.Broker;
import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.Connection; import org.apache.activemq.broker.Connection;
@ -326,17 +325,13 @@ public class RegionBroker extends EmptyBroker {
switch (destination.getDestinationType()) { switch (destination.getDestinationType()) {
case ActiveMQDestination.QUEUE_TYPE: case ActiveMQDestination.QUEUE_TYPE:
queueRegion.removeDestination(context, destination, timeout); queueRegion.removeDestination(context, destination, timeout);
removeAdvisoryTopics("Queue.", context, destination, timeout);
break; break;
case ActiveMQDestination.TOPIC_TYPE: case ActiveMQDestination.TOPIC_TYPE:
topicRegion.removeDestination(context, destination, timeout); topicRegion.removeDestination(context, destination, timeout);
removeAdvisoryTopics("Topic.", context, destination, timeout);
break; break;
case ActiveMQDestination.TEMP_QUEUE_TYPE: case ActiveMQDestination.TEMP_QUEUE_TYPE:
tempQueueRegion.removeDestination(context, destination, timeout);
break; break;
case ActiveMQDestination.TEMP_TOPIC_TYPE: case ActiveMQDestination.TEMP_TOPIC_TYPE:
tempTopicRegion.removeDestination(context, destination, timeout);
break; break;
default: default:
throw createUnknownDestinationTypeException(destination); throw createUnknownDestinationTypeException(destination);
@ -347,25 +342,6 @@ public class RegionBroker extends EmptyBroker {
} }
public void removeAdvisoryTopics(String destinationType, ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception {
if (this.brokerService.isAdvisorySupport()) {
String producerAdvisoryTopic = AdvisorySupport.PRODUCER_ADVISORY_TOPIC_PREFIX + destinationType + destination.getPhysicalName();
String consumerAdvisoryTopic = AdvisorySupport.CONSUMER_ADVISORY_TOPIC_PREFIX + destinationType + destination.getPhysicalName();
ActiveMQDestination dests[] = getDestinations();
for (ActiveMQDestination dest: dests) {
String name = dest.getPhysicalName();
if ( name.equals(producerAdvisoryTopic) || name.equals(consumerAdvisoryTopic) ) {
try {
removeDestination(context, dest, timeout);
} catch (JMSException ignore) {
// at least ignore the Unknown Destination Type JMSException
}
}
}
}
}
@Override @Override
public void addDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception { public void addDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception {
addDestination(context, info.getDestination(),true); addDestination(context, info.getDestination(),true);