当前位置: 首页>>代码示例>>Java>>正文


Java BrokerService.waitUntilStopped方法代码示例

本文整理汇总了Java中org.apache.activemq.broker.BrokerService.waitUntilStopped方法的典型用法代码示例。如果您正苦于以下问题:Java BrokerService.waitUntilStopped方法的具体用法?Java BrokerService.waitUntilStopped怎么用?Java BrokerService.waitUntilStopped使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.activemq.broker.BrokerService的用法示例。


在下文中一共展示了BrokerService.waitUntilStopped方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testMbeanPresenceOnNetworkBrokerRestart

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Test
public void testMbeanPresenceOnNetworkBrokerRestart() throws Exception {
   BrokerService broker = createBroker();
   try {
      broker.start();
      assertEquals(1, countMbeans(broker, "connector", 30000));
      assertEquals(0, countMbeans(broker, "connectionName"));
      BrokerService networkedBroker = null;
      for (int i = 0; i < numRestarts; i++) {
         networkedBroker = createNetworkedBroker();
         try {
            networkedBroker.start();
            assertEquals(1, countMbeans(networkedBroker, "networkBridge", 2000));
            assertEquals(1, countMbeans(broker, "networkBridge", 2000));
            assertEquals(2, countMbeans(broker, "connectionName"));
         } finally {
            networkedBroker.stop();
            networkedBroker.waitUntilStopped();
         }
         assertEquals(0, countMbeans(networkedBroker, "stopped"));
         assertEquals(0, countMbeans(broker, "networkBridge"));
      }

      assertEquals(0, countMbeans(networkedBroker, "networkBridge"));
      assertEquals(0, countMbeans(networkedBroker, "connector"));
      assertEquals(0, countMbeans(networkedBroker, "connectionName"));
      assertEquals(1, countMbeans(broker, "connector"));
   } finally {
      broker.stop();
      broker.waitUntilStopped();
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:33,代码来源:DuplexNetworkMBeanTest.java

示例2: testMbeanPresenceOnBrokerRestart

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Test
public void testMbeanPresenceOnBrokerRestart() throws Exception {

   BrokerService networkedBroker = createNetworkedBroker();
   try {
      networkedBroker.start();
      assertEquals(1, countMbeans(networkedBroker, "connector=networkConnectors", 30000));
      assertEquals(0, countMbeans(networkedBroker, "connectionName"));

      BrokerService broker = null;
      for (int i = 0; i < numRestarts; i++) {
         broker = createBroker();
         try {
            broker.start();
            assertEquals(1, countMbeans(networkedBroker, "networkBridge", 5000));
            assertEquals("restart number: " + i, 2, countMbeans(broker, "connectionName", 10000));
         } finally {
            broker.stop();
            broker.waitUntilStopped();
         }
         assertEquals(0, countMbeans(broker, "stopped"));
      }

      assertEquals(1, countMbeans(networkedBroker, "connector=networkConnectors"));
      assertEquals(0, countMbeans(networkedBroker, "connectionName"));
      assertEquals(0, countMbeans(broker, "connectionName"));
   } finally {
      networkedBroker.stop();
      networkedBroker.waitUntilStopped();
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:32,代码来源:DuplexNetworkMBeanTest.java

示例3: destroyBrokerCluster

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
protected void destroyBrokerCluster() throws JMSException, Exception {
   for (BrokerService b : brokers.values()) {
      try {
         b.stop();
         b.waitUntilStopped();
      } catch (Exception e) {
         // Keep on going, we want to try and stop them all.
         logger.info("Error while stopping broker[" + b.getBrokerName() + "] continuing...");
      }
   }
   brokers.clear();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:13,代码来源:FailoverClusterTestSupport.java

示例4: stopBrokerWithStoreFailure

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void stopBrokerWithStoreFailure(BrokerService broker, PersistenceAdapterChoice choice) throws Exception {
   switch (choice) {
      case KahaDB:
         KahaDBPersistenceAdapter kahaDBPersistenceAdapter = (KahaDBPersistenceAdapter) broker.getPersistenceAdapter();

         // have the broker stop with an IOException on next checkpoint so it has a pending local transaction to recover
         kahaDBPersistenceAdapter.getStore().getJournal().close();
         break;
      default:
         // just stop normally by default
         broker.stop();
   }
   broker.waitUntilStopped();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:15,代码来源:TestSupport.java

示例5: stopBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private void stopBroker(BrokerService searchBroker) throws Exception {
	searchBroker.stop();
	searchBroker.waitUntilStopped();
}
 
开发者ID:oneops,项目名称:oneops,代码行数:5,代码来源:SearchSenderTest.java

示例6: stopBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void stopBroker(BrokerService broker) throws Exception {
  if (broker != null) {
    broker.stop();
    broker.waitUntilStopped();
  }
}
 
开发者ID:vert-x3,项目名称:vertx-amqp-bridge,代码行数:7,代码来源:ActiveMQTestBase.java

示例7: doTestScheduleRepeated

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void doTestScheduleRepeated(File existingStore) throws Exception {
   File testDir = new File("target/activemq-data/store/scheduler/versionDB");
   IOHelper.deleteFile(testDir);
   IOHelper.copyFile(existingStore, testDir);

   final int NUMBER = 10;
   ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost");

   for (int i = 0; i < 3; ++i) {
      JobSchedulerStoreImpl scheduler = new JobSchedulerStoreImpl();
      scheduler.setDirectory(testDir);
      scheduler.setJournalMaxFileLength(1024 * 1024);
      BrokerService broker = createBroker(scheduler);
      broker.start();
      broker.waitUntilStarted();

      final AtomicInteger count = new AtomicInteger();
      Connection connection = cf.createConnection();

      Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      Queue queue = session.createQueue("test.queue");

      MessageConsumer consumer = session.createConsumer(queue);

      final CountDownLatch latch = new CountDownLatch(NUMBER);
      consumer.setMessageListener(new MessageListener() {
         @Override
         public void onMessage(Message message) {
            LOG.info("Received scheduled message: {}", message);
            latch.countDown();
            count.incrementAndGet();
         }
      });

      connection.start();
      assertEquals(latch.getCount(), NUMBER);
      latch.await(30, TimeUnit.SECONDS);

      connection.close();
      broker.stop();
      broker.waitUntilStopped();

      assertEquals(0, latch.getCount());
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:46,代码来源:SchedulerDBVersionTest.java

示例8: stopBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
protected void stopBroker(String name) throws Exception {
   BrokerService broker = brokers.remove(name);
   broker.stop();
   broker.waitUntilStopped();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:6,代码来源:FailoverClusterTestSupport.java

示例9: stopBroker

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void stopBroker(BrokerService broker) throws Exception {
   if (broker != null) {
      broker.stop();
      broker.waitUntilStopped();
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:7,代码来源:NIOSSLBasicTest.java


注:本文中的org.apache.activemq.broker.BrokerService.waitUntilStopped方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。