Search in sources :

Example 1 with JMSExceptionListener

use of org.apache.oozie.jms.JMSExceptionListener in project oozie by apache.

the class JMSAccessorService method createConnectionContext.

public ConnectionContext createConnectionContext(JMSConnectionInfo connInfo) {
    ConnectionContext connCtxt = connectionMap.get(connInfo);
    if (connCtxt == null) {
        try {
            connCtxt = getConnectionContextImpl();
            connCtxt.createConnection(connInfo.getJNDIProperties());
            connCtxt.setExceptionListener(new JMSExceptionListener(connInfo, connCtxt, true));
            connectionMap.put(connInfo, connCtxt);
            LOG.info("Connection established to JMS Server for [{0}]", connInfo);
        } catch (Exception e) {
            LOG.warn("Exception while establishing connection to JMS Server for [{0}]", connInfo, e);
            return null;
        }
    }
    return connCtxt;
}
Also used : ConnectionContext(org.apache.oozie.jms.ConnectionContext) DefaultConnectionContext(org.apache.oozie.jms.DefaultConnectionContext) JMSExceptionListener(org.apache.oozie.jms.JMSExceptionListener) JMSException(javax.jms.JMSException)

Example 2 with JMSExceptionListener

use of org.apache.oozie.jms.JMSExceptionListener in project oozie by apache.

the class JMSAccessorService method createProducerConnectionContext.

public ConnectionContext createProducerConnectionContext(JMSConnectionInfo connInfo) {
    if (jmsProducerConnContext != null && jmsProducerConnContext.isConnectionInitialized()) {
        return jmsProducerConnContext;
    } else {
        synchronized (this) {
            if (jmsProducerConnContext == null || !jmsProducerConnContext.isConnectionInitialized()) {
                try {
                    jmsProducerConnContext = getConnectionContextImpl();
                    jmsProducerConnContext.createConnection(connInfo.getJNDIProperties());
                    jmsProducerConnContext.setExceptionListener(new JMSExceptionListener(connInfo, jmsProducerConnContext, false));
                    LOG.info("Connection established to JMS Server for [{0}]", connInfo);
                } catch (Exception e) {
                    LOG.warn("Exception while establishing connection to JMS Server for [{0}]", connInfo, e);
                    return null;
                }
            }
        }
    }
    return jmsProducerConnContext;
}
Also used : JMSExceptionListener(org.apache.oozie.jms.JMSExceptionListener) JMSException(javax.jms.JMSException)

Aggregations

JMSException (javax.jms.JMSException)2 JMSExceptionListener (org.apache.oozie.jms.JMSExceptionListener)2 ConnectionContext (org.apache.oozie.jms.ConnectionContext)1 DefaultConnectionContext (org.apache.oozie.jms.DefaultConnectionContext)1