Example usage for javax.jms JMSException JMSException

List of usage examples for javax.jms JMSException JMSException

Introduction

In this page you can find the example usage for javax.jms JMSException JMSException.

Prototype

public JMSException(String reason) 

Source Link

Document

Constructs a JMSException with the specified reason and with the error code defaulting to null.

Usage

From source file:org.wso2.carbon.transport.jms.factory.PooledJMSConnectionFactory.java

@Override
public Connection createConnection() throws JMSException {
    PooledConnectionKey key = new PooledConnectionKey(null, null);
    Connection connection;//from www .j a  va 2  s  .c  o m
    try {
        connection = keyedObjectPool.borrowObject(key);

        if (!validateObject(key, new DefaultPooledObject<>(connection))) {
            keyedObjectPool.invalidateObject(key, connection);
            throw new JMSException("Could not create a valid connection");
        }

        return connection;
    } catch (Exception e) {
        throw new JMSException("Error occurred creating connection : " + e.getMessage());
    }
}

From source file:org.wso2.carbon.transport.jms.factory.PooledJMSConnectionFactory.java

@Override
public Connection createConnection(String userName, String password) throws JMSException {
    PooledConnectionKey key = new PooledConnectionKey(userName, password);
    try {//w  w w .  j  a  v  a2s .  c  o m
        return keyedObjectPool.borrowObject(key);
    } catch (Exception e) {
        throw new JMSException("Error occurred creating connection : " + e.getMessage());
    }
}