Search in sources :

Example 1 with ActiveMQConnection

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();
}
Also used : ActiveMQConnection(org.apache.activemq.ActiveMQConnection) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with ActiveMQConnection

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;
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) ActiveMQConnection(org.apache.activemq.ActiveMQConnection) Map(java.util.Map) HashMap(java.util.HashMap)

Example 3 with ActiveMQConnection

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;
}
Also used : SocketGetter(com.navercorp.pinpoint.plugin.activemq.client.field.getter.SocketGetter) ActiveMQConnection(org.apache.activemq.ActiveMQConnection) TransportGetter(com.navercorp.pinpoint.plugin.activemq.client.field.getter.TransportGetter) Transport(org.apache.activemq.transport.Transport)

Example 4 with ActiveMQConnection

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;
}
Also used : SocketGetter(com.navercorp.pinpoint.plugin.activemq.client.field.getter.SocketGetter) ActiveMQConnection(org.apache.activemq.ActiveMQConnection) TransportGetter(com.navercorp.pinpoint.plugin.activemq.client.field.getter.TransportGetter) Transport(org.apache.activemq.transport.Transport)

Example 5 with ActiveMQConnection

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();
}
Also used : ActiveMQConnection(org.apache.activemq.ActiveMQConnection) Test(org.junit.Test)

Aggregations

ActiveMQConnection (org.apache.activemq.ActiveMQConnection)12 Test (org.junit.Test)5 SocketGetter (com.navercorp.pinpoint.plugin.activemq.client.field.getter.SocketGetter)4 Transport (org.apache.activemq.transport.Transport)4 ActiveMQSessionGetter (com.navercorp.pinpoint.plugin.activemq.client.field.getter.ActiveMQSessionGetter)2 TransportGetter (com.navercorp.pinpoint.plugin.activemq.client.field.getter.TransportGetter)2 Socket (java.net.Socket)2 SocketAddress (java.net.SocketAddress)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)2 ActiveMQSession (org.apache.activemq.ActiveMQSession)2 ActiveMQDestination (org.apache.activemq.command.ActiveMQDestination)2 SpanEventRecorder (com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder)1 Trace (com.navercorp.pinpoint.bootstrap.context.Trace)1 InvocationHandler (java.lang.reflect.InvocationHandler)1 Connection (javax.jms.Connection)1 NamingException (javax.naming.NamingException)1 RedeliveryPolicy (org.apache.activemq.RedeliveryPolicy)1 ActiveMQMessage (org.apache.activemq.command.ActiveMQMessage)1