Search in sources :

Example 31 with PoolingException

use of com.sun.appserv.connectors.internal.api.PoolingException in project Payara by payara.

the class PoolManagerImpl method createEmptyConnectionPool.

public void createEmptyConnectionPool(PoolInfo poolInfo, PoolType pt, Hashtable env) throws PoolingException {
    // Create and initialise the connection pool
    createAndInitPool(poolInfo, pt, env);
    if (listener != null) {
        try {
            listener.poolCreated(poolInfo);
        } catch (Exception ex) {
            if (_logger.isLoggable(Level.FINE)) {
                _logger.log(Level.FINE, "Exception thrown on pool listener");
            }
        }
    }
    // notify mcf-create
    ManagedConnectionFactory mcf = ConnectorRegistry.getInstance().getManagedConnectionFactory(poolInfo);
    if (mcf != null) {
        if (mcf instanceof MCFLifecycleListener) {
            ((MCFLifecycleListener) mcf).mcfCreated();
        }
    }
}
Also used : MCFLifecycleListener(com.sun.appserv.connectors.internal.spi.MCFLifecycleListener) ManagedConnectionFactory(javax.resource.spi.ManagedConnectionFactory) PoolingException(com.sun.appserv.connectors.internal.api.PoolingException) ResourceException(javax.resource.ResourceException) InvocationException(org.glassfish.api.invocation.InvocationException) RetryableUnavailableException(javax.resource.spi.RetryableUnavailableException)

Example 32 with PoolingException

use of com.sun.appserv.connectors.internal.api.PoolingException in project Payara by payara.

the class RWLockDataStructure method addResource.

/**
 * {@inheritDoc}
 */
public int addResource(ResourceAllocator allocator, int count) throws PoolingException {
    int numResAdded = 0;
    writeLock.lock();
    // for now, coarser lock. finer lock needs "resources.size() < maxSize()" once more.
    try {
        for (int i = 0; i < count && resources.size() < maxSize; i++) {
            ResourceHandle handle = handler.createResource(allocator);
            resources.add(handle);
            numResAdded++;
        }
    } catch (Exception e) {
        PoolingException pe = new PoolingException(e.getMessage());
        pe.initCause(e);
        throw pe;
    } finally {
        writeLock.unlock();
    }
    return numResAdded;
}
Also used : PoolingException(com.sun.appserv.connectors.internal.api.PoolingException) ResourceHandle(com.sun.enterprise.resource.ResourceHandle) PoolingException(com.sun.appserv.connectors.internal.api.PoolingException)

Aggregations

PoolingException (com.sun.appserv.connectors.internal.api.PoolingException)32 ResourceException (javax.resource.ResourceException)17 ResourceHandle (com.sun.enterprise.resource.ResourceHandle)9 ManagedConnection (javax.resource.spi.ManagedConnection)7 InvocationException (org.glassfish.api.invocation.InvocationException)5 PrivilegedAction (java.security.PrivilegedAction)4 RetryableUnavailableException (javax.resource.spi.RetryableUnavailableException)4 JavaEETransaction (com.sun.enterprise.transaction.api.JavaEETransaction)3 JavaEETransactionManager (com.sun.enterprise.transaction.api.JavaEETransactionManager)3 NamingException (javax.naming.NamingException)3 SystemException (javax.transaction.SystemException)3 XAResource (javax.transaction.xa.XAResource)3 ComponentInvocation (org.glassfish.api.invocation.ComponentInvocation)3 InvocationManager (org.glassfish.api.invocation.InvocationManager)3 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)2 ResourceSpec (com.sun.enterprise.resource.ResourceSpec)2 ConnectionEventListener (com.sun.enterprise.resource.listener.ConnectionEventListener)2 PoolManager (com.sun.enterprise.resource.pool.PoolManager)2 ManagedConnectionFactory (javax.resource.spi.ManagedConnectionFactory)2 Transaction (javax.transaction.Transaction)2