本文整理汇总了Java中org.apache.activemq.broker.TransportConnector.stop方法的典型用法代码示例。如果您正苦于以下问题:Java TransportConnector.stop方法的具体用法?Java TransportConnector.stop怎么用?Java TransportConnector.stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.broker.TransportConnector
的用法示例。
在下文中一共展示了TransportConnector.stop方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stop
import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
/**
* Stopping ActiveMQ embedded broker
*
* @return true if broker is successfully stopped
*/
public boolean stop() {
try {
log.info(" ************* Stopping **************");
if (broker.isStarted()) {
broker.stop();
for (TransportConnector transportConnector : transportConnectors) {
transportConnector.stop();
}
setBrokerStatus(false);
}
return true;
} catch (Exception e) {
log.error("Error while shutting down the broker", e);
return false;
}
}
示例2: stop
import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
/**
* Stopping ActiveMQ embedded broker
* @return true if broker is successfully stopped
*/
public boolean stop() {
try {
log.info(" ************* Stopping **************");
if (broker.isStarted()) {
broker.stop();
for(TransportConnector transportConnector : transportConnectors) {
transportConnector.stop();
}
setBrokerStatus(false);
}
return true;
} catch (Exception e) {
log.error("Error while shutting down the broker", e);
return false;
}
}
示例3: stopBroker
import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
private boolean stopBroker() {
try {
log.info(" ************* Stopping **************");
if (broker.isStarted()) {
broker.stop();
for(TransportConnector transportConnector : getTCPConnectors()) {
transportConnector.stop();
}
}
return true;
} catch (Exception e) {
log.error("Error while shutting down the broker", e);
return false;
}
}
示例4: removeConnector
import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
@Override
public boolean removeConnector(String connectorName) throws Exception {
TransportConnector connector = brokerService.getConnectorByName(connectorName);
if (connector == null) {
throw new NoSuchElementException("Not connector matched the given name: " + connectorName);
}
connector.stop();
return brokerService.removeConnector(connector);
}
示例5: stopBroker
import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
private void stopBroker(final BrokerService broker) throws Exception {
if (broker == null) return;
if (broker.getJmsBridgeConnectors() != null) {
for (final JmsConnector connector : broker.getJmsBridgeConnectors()) {
connector.stop();
}
}
for (final Object o : broker.getTransportConnectors()) {
final TransportConnector tc = (TransportConnector) o;
tc.stop();
}
broker.stop();
}
示例6: testPublisherFailsOver
import org.apache.activemq.broker.TransportConnector; //导入方法依赖的package包/类
public void testPublisherFailsOver() throws Exception {
ActiveMQDestination destination = new ActiveMQQueue("TEST");
int deliveryMode = DeliveryMode.NON_PERSISTENT;
// Start a normal consumer on the local broker
StubConnection connection1 = createConnection();
ConnectionInfo connectionInfo1 = createConnectionInfo();
SessionInfo sessionInfo1 = createSessionInfo(connectionInfo1);
ConsumerInfo consumerInfo1 = createConsumerInfo(sessionInfo1, destination);
connection1.send(connectionInfo1);
connection1.send(sessionInfo1);
connection1.request(consumerInfo1);
// Start a normal consumer on a remote broker
StubConnection connection2 = createRemoteConnection();
ConnectionInfo connectionInfo2 = createConnectionInfo();
SessionInfo sessionInfo2 = createSessionInfo(connectionInfo2);
ConsumerInfo consumerInfo2 = createConsumerInfo(sessionInfo2, destination);
connection2.send(connectionInfo2);
connection2.send(sessionInfo2);
connection2.request(consumerInfo2);
// Start a failover publisher.
StubConnection connection3 = createFailoverConnection();
ConnectionInfo connectionInfo3 = createConnectionInfo();
SessionInfo sessionInfo3 = createSessionInfo(connectionInfo3);
ProducerInfo producerInfo3 = createProducerInfo(sessionInfo3);
connection3.send(connectionInfo3);
connection3.send(sessionInfo3);
connection3.send(producerInfo3);
// Send the message using the fail over publisher.
connection3.request(createMessage(producerInfo3, destination, deliveryMode));
// The message will be sent to one of the brokers.
FailoverTransport ft = connection3.getTransport().narrow(FailoverTransport.class);
// See which broker we were connected to.
StubConnection connectionA;
StubConnection connectionB;
TransportConnector serverA;
if (connector.getServer().getConnectURI().getPort() == ft.getConnectedTransportURI().getPort()) {
connectionA = connection1;
connectionB = connection2;
serverA = connector;
} else {
connectionA = connection2;
connectionB = connection1;
serverA = remoteConnector;
}
assertNotNull(receiveMessage(connectionA));
assertNoMessagesLeft(connectionB);
// Dispose the server so that it fails over to the other server.
LOG.info("Disconnecting active server");
serverA.stop();
LOG.info("Sending request that should failover");
connection3.request(createMessage(producerInfo3, destination, deliveryMode));
assertNotNull(receiveMessage(connectionB));
assertNoMessagesLeft(connectionA);
}