PurgeCommandTest.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:activemq-artemis 作者:
/**
 * This test ensures that the queueViewMbean will work.
 *
 * @throws Exception
 */
public void testQueueViewMbean() throws Exception {

   try {
      addMessages();

      validateCounts(MESSAGE_COUNT, MESSAGE_COUNT, MESSAGE_COUNT * 2);

      List<String> tokens = Arrays.asList(new String[]{"*"});
      for (String token : tokens) {
         List<ObjectInstance> queueList = JmxMBeansUtil.queryMBeans(createJmxConnection(), "type=Broker,brokerName=localbroker,destinationType=Queue,destinationName=" + token);

         for (ObjectInstance queue : queueList) {
            ObjectName queueName = queue.getObjectName();
            QueueViewMBean proxy = MBeanServerInvocationHandler.newProxyInstance(createJmxConnection(), queueName, QueueViewMBean.class, true);
            int removed = proxy.removeMatchingMessages(MSG_SEL_WITH_PROPERTY);
            LOG.info("Removed: " + removed);
         }
      }

      validateCounts(0, MESSAGE_COUNT, MESSAGE_COUNT);

   } finally {
      purgeAllMessages();
   }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号