當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。