mirror of https://github.com/apache/activemq.git
https://issues.apache.org/activemq/browse/AMQ-2323 - dupliactes with composite destinations
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@936811 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
956c3e0df2
commit
f8b0c22d0f
|
@ -22,9 +22,11 @@ import java.io.ObjectInput;
|
|||
import java.io.ObjectOutput;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.jms.Destination;
|
||||
|
@ -249,7 +251,7 @@ public abstract class ActiveMQDestination extends JNDIBaseStorable implements Da
|
|||
this.hashValue = 0;
|
||||
if (composite) {
|
||||
// Check to see if it is a composite.
|
||||
List<String> l = new ArrayList<String>();
|
||||
Set<String> l = new HashSet<String>();
|
||||
StringTokenizer iter = new StringTokenizer(physicalName, "" + COMPOSITE_SEPERATOR);
|
||||
while (iter.hasMoreTokens()) {
|
||||
String name = iter.nextToken().trim();
|
||||
|
@ -258,12 +260,10 @@ public abstract class ActiveMQDestination extends JNDIBaseStorable implements Da
|
|||
}
|
||||
l.add(name);
|
||||
}
|
||||
if (l.size() > 1) {
|
||||
compositeDestinations = new ActiveMQDestination[l.size()];
|
||||
int counter = 0;
|
||||
for (String dest : l) {
|
||||
compositeDestinations[counter++] = createDestination(dest);
|
||||
}
|
||||
compositeDestinations = new ActiveMQDestination[l.size()];
|
||||
int counter = 0;
|
||||
for (String dest : l) {
|
||||
compositeDestinations[counter++] = createDestination(dest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,9 +18,19 @@ package org.apache.activemq;
|
|||
|
||||
import javax.jms.DeliveryMode;
|
||||
import javax.jms.Destination;
|
||||
import javax.jms.Message;
|
||||
import javax.jms.MessageConsumer;
|
||||
import javax.jms.Topic;
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.MBeanServerInvocationHandler;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.remote.JMXConnector;
|
||||
import javax.management.remote.JMXConnectorFactory;
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
|
||||
import org.apache.activemq.broker.BrokerService;
|
||||
import org.apache.activemq.broker.jmx.QueueViewMBean;
|
||||
import org.apache.activemq.command.ActiveMQDestination;
|
||||
import org.apache.activemq.test.JmsTopicSendReceiveTest;
|
||||
|
||||
|
||||
|
@ -84,4 +94,26 @@ public class JmsQueueCompositeSendReceiveTest extends JmsTopicSendReceiveTest {
|
|||
assertMessagesAreReceived();
|
||||
LOG.info("" + data.length + " messages(s) received, closing down connections");
|
||||
}
|
||||
|
||||
public void testDuplicate() throws Exception {
|
||||
ActiveMQDestination queue = (ActiveMQDestination)session.createQueue("TEST,TEST");
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
Message message = createMessage(i);
|
||||
configureMessage(message);
|
||||
if (verbose) {
|
||||
LOG.info("About to send a message: " + message + " with text: " + data[i]);
|
||||
}
|
||||
producer.send(queue, message);
|
||||
}
|
||||
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi");
|
||||
JMXConnector connector = JMXConnectorFactory.connect(url, null);
|
||||
connector.connect();
|
||||
MBeanServerConnection connection = connector.getMBeanServerConnection();
|
||||
ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:Type=Queue,Destination=TEST,BrokerName=localhost");
|
||||
|
||||
QueueViewMBean queueMbean = (QueueViewMBean) MBeanServerInvocationHandler.newProxyInstance(connection, queueViewMBeanName, QueueViewMBean.class, true);
|
||||
assertEquals(data.length, queueMbean.getQueueSize());
|
||||
queueMbean.purge();
|
||||
assertEquals(0, queueMbean.getQueueSize());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue