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


Java BrokerService.stop方法代码示例

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


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

示例1: run

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void run() {
    try {  
        BrokerService broker = new BrokerService();
        synchronized (this) {                                     
            broker.setPersistenceAdapter(new MemoryPersistenceAdapter());                    
            broker.setTmpDataDirectory(new File("./target"));
            broker.addConnector(brokerUrl);
            broker.start();
            Thread.sleep(200);
            notifyAll();
        }
        synchronized (this) {
            while (!shutdownBroker) {
                wait(1000);
            }
        }                
        broker.stop();              
        broker = null;                
    } catch (Exception e) {
        exception = e;
        e.printStackTrace();
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:24,代码来源:JmsBroker.java

示例2: run

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void run() {
    try {  
        BrokerService broker = new BrokerService();
        synchronized (this) {                                     
            broker.setPersistenceAdapter(new MemoryPersistenceAdapter());                    
            broker.setTmpDataDirectory(new File("./target"));
            broker.addConnector(brokerUrl);
            broker.start();
            Thread.sleep(200);
            notifyAll();
        }
        synchronized (this) {
            while (!shutdownBroker) {
                wait(1000);
            }
        }                
        broker.stop();              
    } catch (Exception e) {
        exception = e;
        e.printStackTrace();
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:JmsBroker.java

示例3: performJmsTransportTest

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private void performJmsTransportTest(final String springBeanXml) throws IOException, URISyntaxException, Exception
{
	final BrokerService broker = setupJmsBroker();

	//
	// now we get the jax-rs endpoint from the xml config
	try (ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] { springBeanXml }))
	{
		final JAXRSServerFactoryBean sfb = (JAXRSServerFactoryBean)ctx.getBean("jaxrs:server:jms");

		final Server server = sfb.getServer();
		assertThat(server, notNullValue()); // it's important that we can obtain the server bean
		assertThat(server.isStarted(), is(true)); // for all we care, we could also start the server, but we need to know if we have to or not

		runJmsClient();

		server.destroy();
		assertThat(server.isStarted(), is(false));
	}
	finally
	{
		broker.stop();
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:25,代码来源:JaxRsSpringEndpointTests.java

示例4: testServerWithJmsTransport

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Test
public void testServerWithJmsTransport() throws Exception
{
	final BrokerService jmsBroker = setupJmsBroker();
	try
	{
		final List<Class<?>> providers = Arrays.asList(TestService.class, TestService2.class);

		final Server server = createServer(providers);

		assertThat(server, notNullValue()); // it's important that we can obtain the server bean
		assertThat(server.isStarted(), is(true)); // for all we care, we could also start the server, but we need to know if we have to or not

		runJmsClient();

		server.destroy();
		assertThat(server.isStarted(), is(false));
	}
	finally
	{
		jmsBroker.stop();
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:24,代码来源:JaxRsProgramaticTests.java

示例5: testStartupShutdown

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void testStartupShutdown() throws Exception {
   // This systemproperty is used if we dont want to
   // have persistence messages as a default
   System.setProperty("activemq.persistenceAdapter", "org.apache.activemq.store.vm.VMPersistenceAdapter");

   // configuration of container and all protocols
   BrokerService broker = createBroker();

   // start a client
   ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:9100");
   factory.createConnection();

   // stop activemq broker
   broker.stop();

   // start activemq broker again
   broker = createBroker();

   // start a client again
   factory = new ActiveMQConnectionFactory("tcp://localhost:9100");
   factory.createConnection();

   // stop activemq broker
   broker.stop();

}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:27,代码来源:StartAndStopBrokerTest.java

示例6: testRollbackXaErrorCode

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void testRollbackXaErrorCode() throws Exception {
   String brokerName = "rollbackErrorCode";
   BrokerService broker = BrokerFactory.createBroker(new URI("broker:(tcp://localhost:0)/" + brokerName));
   broker.start();
   broker.waitUntilStarted();
   ActiveMQXAConnectionFactory cf = new ActiveMQXAConnectionFactory(broker.getTransportConnectors().get(0).getConnectUri());
   XAConnection connection = (XAConnection) cf.createConnection();
   connection.start();
   XASession session = connection.createXASession();
   XAResource resource = session.getXAResource();

   Xid tid = createXid();
   try {
      resource.rollback(tid);
      fail("Expected xa exception on no tx");
   } catch (XAException expected) {
      LOG.info("got expected xa", expected);
      assertEquals("no tx", XAException.XAER_NOTA, expected.errorCode);
   }
   connection.close();
   broker.stop();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:23,代码来源:ActiveMQXAConnectionFactoryTest.java

示例7: testJournalConfig

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Test
public void testJournalConfig() throws Exception {
   File journalFile = new File(JOURNAL_ROOT + "testJournalConfig/journal");
   recursiveDelete(journalFile);

   BrokerService broker;
   broker = createBroker(new FileSystemResource(CONF_ROOT + "journal-example.xml"));
   try {
      assertEquals("Broker Config Error (brokerName)", "brokerJournalConfigTest", broker.getBrokerName());

      PersistenceAdapter adapter = broker.getPersistenceAdapter();

      assertTrue("Should have created a journal persistence adapter", adapter instanceof JournalPersistenceAdapter);
      assertTrue("Should have created a journal directory at " + journalFile.getAbsolutePath(), journalFile.exists());

      LOG.info("Success");
   } finally {
      if (broker != null) {
         broker.stop();
      }
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:23,代码来源:ConfigTest.java

示例8: stopActiveMq

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private static void stopActiveMq(BrokerService brokerService) {
    log.info("## Shutting down ActiveMQ.");
    // :: Close the AMQ Broker
    try {
        brokerService.stop();
    }
    catch (Exception e) {
        throw new IllegalStateException("Couldn't stop AMQ BrokerService!", e);
    }
    log.info("## ActiveMQ shut down.");
}
 
开发者ID:stolsvik,项目名称:mats,代码行数:12,代码来源:ActiveMqStarter.java

示例9: tearDown

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
public void tearDown() throws Exception {
   for (BrokerService broker : brokers) {
      broker.stop();
   }
   brokers.clear();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:8,代码来源:RequestReplyNoAdvisoryNetworkTest.java

示例10: testCreateTcpConnectionUsingKnownLocalPort

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void testCreateTcpConnectionUsingKnownLocalPort() throws Exception {
   broker = new BrokerService();
   broker.setPersistent(false);
   broker.addConnector("tcp://localhost:61610?wireFormat.tcpNoDelayEnabled=true");
   broker.start();

   // This should create the connection.
   ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61610/localhost:51610");
   connection = (ActiveMQConnection) cf.createConnection();
   assertNotNull(connection);

   connection.close();

   broker.stop();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:16,代码来源:ActiveMQConnectionFactoryTest.java

示例11: 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

示例12: 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

示例13: testLoopbackOnDifferentUrlScheme

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Test
public void testLoopbackOnDifferentUrlScheme() throws Exception {
   final BrokerService brokerServce = new BrokerService();
   brokerServce.setPersistent(false);

   TransportConnector transportConnector = brokerServce.addConnector("nio://0.0.0.0:0");
   // connection filter is bypassed when scheme is different
   final NetworkConnector networkConnector = brokerServce.addNetworkConnector("static:(tcp://" + transportConnector.getConnectUri().getHost() + ":" + transportConnector.getConnectUri().getPort() + ")");

   brokerServce.start();
   brokerServce.waitUntilStarted();

   try {
      Wait.waitFor(new Wait.Condition() {
         @Override
         public boolean isSatisified() throws Exception {
            return 1 == networkConnector.bridges.size();
         }
      });

      final DemandForwardingBridgeSupport loopbackBridge = (DemandForwardingBridgeSupport) networkConnector.bridges.values().iterator().next();
      assertTrue("nc started", networkConnector.isStarted());

      assertTrue("It should get disposed", Wait.waitFor(new Wait.Condition() {
         @Override
         public boolean isSatisified() throws Exception {
            return loopbackBridge.getRemoteBroker().isDisposed();
         }
      }));

      assertEquals("No peer brokers", 0, brokerServce.getBroker().getPeerBrokerInfos().length);

   } finally {
      brokerServce.stop();
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:37,代码来源:NetworkLoopBackTest.java

示例14: tearDown

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
@Override
protected void tearDown() throws Exception {
   super.tearDown();
   master.stop();
   master.waitUntilStopped();
   slaveStarted.await(60, TimeUnit.SECONDS);
   BrokerService brokerService = slave.get();
   if (brokerService != null) {
      brokerService.stop();
   }
   master.stop();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:13,代码来源:QueueMasterSlaveTestSupport.java

示例15: verifyCredentials

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private boolean verifyCredentials(String name) throws Exception {
   boolean result = false;
   BrokerService broker = getBroker(name);
   assertNotNull(name, broker);
   broker.start();
   broker.waitUntilStarted();
   try {
      result = verifySslCredentials(broker);
   } finally {
      broker.stop();
   }
   return result;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:14,代码来源:SslContextNBrokerServiceTest.java


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