Package javax.jms

Examples of javax.jms.ExceptionListener


                }

                while ( connecting.get() && running ) {
                try {
                    connection = adapter.makeConnection(activationSpec);
                    connection.setExceptionListener(new ExceptionListener() {
                        public void onException(JMSException error) {
                            if (!serverSessionPool.isClosing()) {
                                    // initiate reconnection only once, i.e. on initial exception
                                    // and only if not already trying to connect
                                    LOG.error("Connection to broker failed: " + error.getMessage(), error);
View Full Code Here


    public void testSetGetExceptionListener() throws Exception {
        PooledConnectionFactory pcf = new PooledConnectionFactory();
        pcf.setConnectionFactory(new ActiveMQConnectionFactory("vm://test"));

        connection = (TopicConnection) pcf.createConnection();
        ExceptionListener listener = new ExceptionListener() {
            public void onException(JMSException exception) {
            }
        };
        connection.setExceptionListener(listener);
        assertEquals(listener, connection.getExceptionListener());
View Full Code Here

       
        PooledConnection conn =  (PooledConnection) pcf.createConnection();
        ActiveMQConnection amq = conn.getConnection();
        final CountDownLatch gotException = new CountDownLatch(1);
        //amq.set
        conn.setExceptionListener(new ExceptionListener() {
            public void onException(JMSException exception) {
                gotException.countDown();
            }});
        conn.setClientID(getName());
       
View Full Code Here

        assertEquals(true, endpoint.isDisableReplyTo());

        endpoint.setEagerLoadingOfProperties(true);
        assertEquals(true, endpoint.isEagerLoadingOfProperties());

        endpoint.setExceptionListener(new ExceptionListener() {
            public void onException(JMSException exception) {
            }
        });
        assertNotNull(endpoint.getExceptionListener());
View Full Code Here

               
                ActiveMQActivationSpec activationSpec = endpointActivationKey.getActivationSpec();
                try {
                    connection = adapter.makeConnection(activationSpec);
                    connection.start();
                    connection.setExceptionListener(new ExceptionListener() {
                        public void onException(JMSException error) {
                            if (!serverSessionPool.isClosing()) {
                                reconnect(error);
                            }
                        }
View Full Code Here

        }
        TaskExecutor taskExecutor = configuration.getTaskExecutor();
        if (taskExecutor != null) {
            answer.setTaskExecutor(taskExecutor);
        }
        ExceptionListener exceptionListener = configuration.getExceptionListener();
        if (exceptionListener != null) {
            answer.setExceptionListener(exceptionListener);
        }
        return answer;
    }
View Full Code Here

                _conn.getProtocolHandler().getFailoverLatch().countDown();
                _conn.getProtocolHandler().setFailoverLatch(null);
            }
        }

        ExceptionListener listener = _conn._exceptionListener;
        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

   * Invoke the registered JMS ExceptionListener, if any.
   * @param ex the exception that arose during JMS processing
   * @see #setExceptionListener
   */
  protected void invokeExceptionListener(JMSException ex) {
    ExceptionListener exceptionListener = getExceptionListener();
    if (exceptionListener != null) {
      exceptionListener.onException(ex);
    }
  }
View Full Code Here

  protected void prepareConnection(Connection con) throws JMSException {
    if (getClientId() != null) {
      con.setClientID(getClientId());
    }
    if (getExceptionListener() != null || isReconnectOnException()) {
      ExceptionListener listenerToUse = getExceptionListener();
      if (isReconnectOnException()) {
        listenerToUse = new InternalChainedExceptionListener(this, listenerToUse);
      }
      con.setExceptionListener(listenerToUse);
    }
View Full Code Here

              "Set the 'clientId' property on the SingleConnectionFactory instead.");
        }
      }
      else if (method.getName().equals("setExceptionListener")) {
        // Handle setExceptionListener method: add to the chain.
        ExceptionListener currentExceptionListener = this.target.getExceptionListener();
        if (currentExceptionListener instanceof InternalChainedExceptionListener && args[0] != null) {
          ((InternalChainedExceptionListener) currentExceptionListener).addDelegate((ExceptionListener) args[0]);
          return null;
        }
        else {
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.