Search in sources :

Example 1 with ConnectionEventListener

use of com.sun.enterprise.resource.listener.ConnectionEventListener in project Payara by payara.

the class NoTxConnectorAllocator method createResource.

public ResourceHandle createResource() throws PoolingException {
    try {
        ManagedConnection mc = mcf.createManagedConnection(subject, reqInfo);
        ResourceHandle resource = createResourceHandle(mc, spec, this, info);
        ConnectionEventListener l = new ConnectionListenerImpl(resource);
        mc.addConnectionEventListener(l);
        return resource;
    } catch (ResourceException ex) {
        Object[] params = new Object[] { spec.getPoolInfo(), ex.toString() };
        _logger.log(Level.WARNING, "poolmgr.create_resource_error", params);
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "Resource Exception while creating resource", ex);
        }
        if (ex.getLinkedException() != null) {
            _logger.log(Level.WARNING, "poolmgr.create_resource_linked_error", ex.getLinkedException().toString());
        }
        throw new PoolingException(ex);
    }
}
Also used : PoolingException(com.sun.appserv.connectors.internal.api.PoolingException) ResourceHandle(com.sun.enterprise.resource.ResourceHandle) ManagedConnection(javax.resource.spi.ManagedConnection) ResourceException(javax.resource.ResourceException) ConnectionEventListener(com.sun.enterprise.resource.listener.ConnectionEventListener)

Example 2 with ConnectionEventListener

use of com.sun.enterprise.resource.listener.ConnectionEventListener in project Payara by payara.

the class LocalTxConnectorAllocator method createResource.

public ResourceHandle createResource() throws PoolingException {
    try {
        ManagedConnection mc = mcf.createManagedConnection(subject, reqInfo);
        ResourceHandle resource = createResourceHandle(mc, spec, this, info);
        ConnectionEventListener l = new LocalTxConnectionEventListener(resource);
        mc.addConnectionEventListener(l);
        resource.setListener(l);
        XAResource xares = new ConnectorXAResource(resource, spec, this, info);
        resource.fillInResourceObjects(null, xares);
        return resource;
    } catch (ResourceException ex) {
        Object[] params = new Object[] { spec.getPoolInfo(), ex.toString() };
        _logger.log(Level.WARNING, "poolmgr.create_resource_error", params);
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "Resource Exception while creating resource", ex);
        }
        if (ex.getLinkedException() != null) {
            _logger.log(Level.WARNING, "poolmgr.create_resource_linked_error", ex.getLinkedException().toString());
        }
        throw new PoolingException(ex);
    }
}
Also used : PoolingException(com.sun.appserv.connectors.internal.api.PoolingException) XAResource(javax.transaction.xa.XAResource) LocalTxConnectionEventListener(com.sun.enterprise.resource.listener.LocalTxConnectionEventListener) ResourceException(javax.resource.ResourceException) LocalTxConnectionEventListener(com.sun.enterprise.resource.listener.LocalTxConnectionEventListener) ConnectionEventListener(com.sun.enterprise.resource.listener.ConnectionEventListener)

Aggregations

PoolingException (com.sun.appserv.connectors.internal.api.PoolingException)2 ConnectionEventListener (com.sun.enterprise.resource.listener.ConnectionEventListener)2 ResourceException (javax.resource.ResourceException)2 ResourceHandle (com.sun.enterprise.resource.ResourceHandle)1 LocalTxConnectionEventListener (com.sun.enterprise.resource.listener.LocalTxConnectionEventListener)1 ManagedConnection (javax.resource.spi.ManagedConnection)1 XAResource (javax.transaction.xa.XAResource)1