Package javax.jms

Examples of javax.jms.ExceptionListener


        // prior to the addition of our new TransportListener
        if(connection.isTransportFailed()) {
            hasFailed = true;
        }
        */
        connection.setExceptionListener(new ExceptionListener() {
            public void onException(JMSException exception) {
                synchronized (ConnectionPool.this) {
                    hasFailed = true;
                }
            }
View Full Code Here


      {
      }
      connection.close();

      connection = cf.createConnection();
      ExceptionListener listener = connection.getExceptionListener();
      try
      {
         connection.setClientID(clientID);
         fail();
      }
View Full Code Here

    */
   public void testExceptionListener() throws Exception
   {
      Connection conn = cf.createConnection();

      ExceptionListener listener1 = new MyExceptionListener();

      conn.setExceptionListener(listener1);

      ExceptionListener listener2 = conn.getExceptionListener();

      assertNotNull(listener2);

      assertEquals(listener1, listener2);

View Full Code Here

        // Monitor the connection for an exception being thrown
        // this should be a DisconnectionException but it is not this tests
        // job to valiate that. Only use the exception as a synchronisation
        // to check the log file for the Close message
        final CountDownLatch exceptionReceived = new CountDownLatch(1);
        connection.setExceptionListener(new ExceptionListener()
        {
            public void onException(JMSException e)
            {
                //Failover being attempted.
                exceptionReceived.countDown();
View Full Code Here

    public void testExceptionListenerHearsBrokerShutdown() throws  Exception
    {
        final CountDownLatch exceptionReceivedLatch  = new CountDownLatch(1);
        final AtomicInteger exceptionCounter = new AtomicInteger(0);
        final ExceptionListener listener = new ExceptionListener()
        {
            public void onException(JMSException exception)
            {
                exceptionCounter.incrementAndGet();
                _lastExceptionListenerException = exception;
View Full Code Here

     */
    public void testExceptionListenerClosesConnection_IsAllowed() throws  Exception
    {
        final CountDownLatch exceptionReceivedLatch  = new CountDownLatch(1);
        final Connection connection = getConnection();
        final ExceptionListener listener = new ExceptionListener()
        {
            public void onException(JMSException exception)
            {
                try
                {
View Full Code Here

     */
    public void testExceptionListenerStopsConnection_ThrowsIllegalStateException() throws  Exception
    {
        final CountDownLatch exceptionReceivedLatch  = new CountDownLatch(1);
        final Connection connection = getConnection();
        final ExceptionListener listener = new ExceptionListener()
        {
            public void onException(JMSException exception)
            {
                try
                {
View Full Code Here

        // Install an exception listener that stops/closes the connection on receipt of 2nd AMQNoRouteException.
        // (Triggering on the 2nd (rather than 1st) seems to increase the probability that the test ends in deadlock,
        // at least on my machine).
        final CountDownLatch exceptionReceivedLatch  = new CountDownLatch(2);
        final ExceptionListener listener = new ExceptionListener()
        {
            public void onException(JMSException exception)
            {
                try
                {
View Full Code Here

            }
        }

        _conn.setClosed();

        ExceptionListener listener = _conn.getExceptionListenerNoCheck();
        if (listener == null)
        {
            _logger.error("connection exception: " + conn, exc);
        }
        else
        {
            String code = null;
            if (close != null)
            {
                code = close.getReplyCode().toString();
            }

            JMSException ex = new JMSException(exc.getMessage(), code);
            ex.setLinkedException(exc);
            ex.initCause(exc);
            listener.onException(ex);
        }
    }
View Full Code Here

         if (conn != null)
         {
            try
            {
               final ExceptionListener exceptionListener = conn.getExceptionListener();

               if (exceptionListener != null)
               {
                  final JMSException je = new JMSException(me.toString(), failedOver?EXCEPTION_FAILOVER: EXCEPTION_DISCONNECT);

                  je.initCause(me);

                  new Thread(new Runnable()
                  {
                     public void run()
                     {
                        exceptionListener.onException(je);
                     }
                  }).start();
               }
            }
            catch (JMSException e)
View Full Code Here

TOP

Related Classes of javax.jms.ExceptionListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.