Search in sources :

Example 11 with ActiveMQInternalErrorException

use of org.apache.activemq.artemis.api.core.ActiveMQInternalErrorException in project activemq-artemis by apache.

the class ExceptionListenerTest method testListenerCalledForOneConnection.

@Test
public void testListenerCalledForOneConnection() throws Exception {
    Connection conn = cf.createConnection();
    CountDownLatch latch = new CountDownLatch(1);
    MyExceptionListener listener = new MyExceptionListener(latch);
    conn.setExceptionListener(listener);
    ClientSessionInternal coreSession = (ClientSessionInternal) ((ActiveMQConnection) conn).getInitialSession();
    coreSession.getConnection().fail(new ActiveMQInternalErrorException("blah"));
    latch.await(5, TimeUnit.SECONDS);
    Assert.assertEquals(1, listener.numCalls);
    conn.close();
}
Also used : ClientSessionInternal(org.apache.activemq.artemis.core.client.impl.ClientSessionInternal) Connection(javax.jms.Connection) ActiveMQConnection(org.apache.activemq.artemis.jms.client.ActiveMQConnection) ActiveMQInternalErrorException(org.apache.activemq.artemis.api.core.ActiveMQInternalErrorException) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.junit.Test)

Aggregations

ActiveMQInternalErrorException (org.apache.activemq.artemis.api.core.ActiveMQInternalErrorException)11 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)8 Test (org.junit.Test)5 ClientSessionInternal (org.apache.activemq.artemis.core.client.impl.ClientSessionInternal)4 CountDownLatch (java.util.concurrent.CountDownLatch)3 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)3 Packet (org.apache.activemq.artemis.core.protocol.core.Packet)3 ActiveMQExceptionMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ActiveMQExceptionMessage)3 RemotingConnection (org.apache.activemq.artemis.spi.core.protocol.RemotingConnection)3 Connection (javax.jms.Connection)2 Session (javax.jms.Session)2 ActiveMQClusterSecurityException (org.apache.activemq.artemis.api.core.ActiveMQClusterSecurityException)2 ActiveMQSecurityException (org.apache.activemq.artemis.api.core.ActiveMQSecurityException)2 ServerSessionPacketHandler (org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler)2 ActiveMQConnection (org.apache.activemq.artemis.jms.client.ActiveMQConnection)2 ActiveMQSession (org.apache.activemq.artemis.jms.client.ActiveMQSession)2 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1 JMSException (javax.jms.JMSException)1 Queue (javax.jms.Queue)1 ActiveMQIOErrorException (org.apache.activemq.artemis.api.core.ActiveMQIOErrorException)1