use of org.apache.activemq.ActiveMQConnection in project pinpoint by naver.
the class TestBroker method stop.
void stop() throws Exception {
for (Map.Entry<String, ActiveMQConnection> e : this.connections.entrySet()) {
ActiveMQConnection connection = e.getValue();
connection.close();
}
this.brokerService.stop();
this.brokerService.waitUntilStopped();
}
use of org.apache.activemq.ActiveMQConnection in project pinpoint by naver.
the class TestBroker method start.
boolean start() throws Exception {
this.brokerService.start();
// but this method was only introduced in 5.3.0
for (Map.Entry<String, ActiveMQConnectionFactory> e : this.connectionFactories.entrySet()) {
String connectUri = e.getKey();
ActiveMQConnectionFactory connectionFactory = e.getValue();
ActiveMQConnection connection = (ActiveMQConnection) connectionFactory.createConnection();
connection.setClientID("client_" + connectUri);
connection.start();
this.connections.put(connectUri, connection);
}
return true;
}
use of org.apache.activemq.ActiveMQConnection in project pinpoint by naver.
the class ActiveMQMessageConsumerDispatchInterceptor method validateTransport.
private boolean validateTransport(ActiveMQSession session) {
if (session == null) {
return false;
}
ActiveMQConnection connection = session.getConnection();
if (!(connection instanceof TransportGetter)) {
if (isDebug) {
logger.debug("Invalid connection object. Need field accessor({}).", TransportGetter.class.getName());
}
return false;
}
Transport transport = getRootTransport(((TransportGetter) connection)._$PINPOINT$_getTransport());
if (!(transport instanceof SocketGetter)) {
if (isDebug) {
logger.debug("Transport not traceable({}).", transport.getClass().getName());
}
return false;
}
return true;
}
use of org.apache.activemq.ActiveMQConnection in project pinpoint by naver.
the class ActiveMQMessageProducerSendInterceptor method validateTransport.
private boolean validateTransport(ActiveMQSession session) {
if (session == null) {
return false;
}
ActiveMQConnection connection = session.getConnection();
if (!(connection instanceof TransportGetter)) {
if (isDebug) {
logger.debug("Invalid connection object. Need field accessor({}).", TransportGetter.class.getName());
}
return false;
}
Transport transport = getRootTransport(((TransportGetter) connection)._$PINPOINT$_getTransport());
if (!(transport instanceof SocketGetter)) {
if (isDebug) {
logger.debug("Transport not traceable({}).", transport.getClass().getName());
}
return false;
}
return true;
}
use of org.apache.activemq.ActiveMQConnection in project camel by apache.
the class ConnectionFactoryResourceTest method testBorrowObject.
@Test(expected = NoSuchElementException.class)
public void testBorrowObject() throws Exception {
ConnectionFactoryResource pool = new ConnectionFactoryResource(1, connectionFactory);
pool.fillPool();
assertNotNull(pool);
ActiveMQConnection connection = (ActiveMQConnection) pool.borrowConnection();
assertNotNull(connection);
assertTrue(connection.isStarted());
pool.borrowConnection();
}
Aggregations