mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-4711 - totalMessageCount stat is not decremented after destination removal
This commit is contained in:
parent
0525772190
commit
a0c1781c4e
|
@ -105,6 +105,9 @@ public class CountStatisticImpl extends StatisticImpl implements CountStatistic
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParent(CountStatisticImpl parent) {
|
public void setParent(CountStatisticImpl parent) {
|
||||||
|
if (this.parent != null) {
|
||||||
|
this.parent.subtract(this.getCount());
|
||||||
|
}
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -189,6 +189,26 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testRemoveQueue() throws Exception {
|
||||||
|
String queueName = "TEST";
|
||||||
|
ObjectName brokerName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost");
|
||||||
|
BrokerViewMBean broker = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, BrokerViewMBean.class, true);
|
||||||
|
broker.addQueue(queueName);
|
||||||
|
|
||||||
|
ObjectName queueViewMBeanName = assertRegisteredObjectName(domain + ":type=Broker,brokerName=localhost,destinationType=Queue,destinationName=" + queueName);
|
||||||
|
|
||||||
|
QueueViewMBean queue = MBeanServerInvocationHandler.newProxyInstance(mbeanServer, queueViewMBeanName, QueueViewMBean.class, true);
|
||||||
|
queue.sendTextMessage("message 1");
|
||||||
|
queue.sendTextMessage("message 2");
|
||||||
|
|
||||||
|
assertEquals(2, broker.getTotalMessageCount());
|
||||||
|
|
||||||
|
broker.removeQueue(queueName);
|
||||||
|
|
||||||
|
assertEquals(0, broker.getTotalMessageCount());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void testRetryMessages() throws Exception {
|
public void testRetryMessages() throws Exception {
|
||||||
// lets speed up redelivery
|
// lets speed up redelivery
|
||||||
ActiveMQConnectionFactory factory = (ActiveMQConnectionFactory) connectionFactory;
|
ActiveMQConnectionFactory factory = (ActiveMQConnectionFactory) connectionFactory;
|
||||||
|
|
Loading…
Reference in New Issue