Package javax.jms

Examples of javax.jms.ExceptionListener


   * 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

  }


  public void onException(JMSException ex) {
    for (Iterator it = this.delegates.iterator(); it.hasNext();) {
      ExceptionListener listener = (ExceptionListener) it.next();
      listener.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

   * 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

    MockControl cfControl = MockControl.createControl(ConnectionFactory.class);
    ConnectionFactory cf = (ConnectionFactory) cfControl.getMock();
    MockControl conControl = MockControl.createControl(Connection.class);
    Connection con = (Connection) conControl.getMock();

    ExceptionListener listener = new ChainedExceptionListener();
    cf.createConnection();
    cfControl.setReturnValue(con, 1);
    con.setExceptionListener(listener);
    conControl.setVoidCallable(1);
    con.getExceptionListener();
View Full Code Here

        throw theException;
      }
    });

    MockControl mockExceptionListener = MockControl.createControl(ExceptionListener.class);
    ExceptionListener exceptionListener = (ExceptionListener) mockExceptionListener.getMock();
    exceptionListener.onException(theException);
    mockExceptionListener.setVoidCallable();
    mockExceptionListener.replay();

    this.container.setExceptionListener(exceptionListener);
    this.container.afterPropertiesSet();
View Full Code Here

            jndiCntxt = new InitialContext();
            ConnectionFactory connFac = (ConnectionFactory) jndiCntxt
                .lookup("ConnectionFactory");
            Connection conn = connFac.createConnection();
            conn.start();
            conn.setExceptionListener(new ExceptionListener() {
                @Override
                public void onException(JMSException jmse) {
                    LOG.error(jmse.toString());
                }
            });
View Full Code Here

    public void testSetExceptionListener() throws Exception {
        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
        connection = (ActiveMQConnection)cf.createConnection();
        assertNull(connection.getExceptionListener());
       
        ExceptionListener exListener = new ExceptionListener() {
      public void onException(JMSException arg0) {
      }
        };
        cf.setExceptionListener(exListener);
       
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.