Search in sources :

Example 16 with ConnectorRuntimeException

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

the class ConnectorConnectionPoolAdminServiceImpl method getConnectorConnectionPool.

/**
 * Returns the connector connection pool object corresponding
 * to the pool name
 *
 * @param poolInfo Name of the pool.MCF pertaining to this pool is
 *                 created/returned.
 * @return Connector connection pool corresponding to this instance
 * @throws ConnectorRuntimeException if creation/retrieval
 *                                   of MCF fails
 */
private ConnectorConnectionPool getConnectorConnectionPool(PoolInfo poolInfo, Hashtable env) throws ConnectorRuntimeException, NamingException {
    String jndiNameForPool = ConnectorAdminServiceUtils.getReservePrefixedJNDINameForPool(poolInfo);
    ConnectorConnectionPool connectorConnectionPool = (ConnectorConnectionPool) _runtime.getResourceNamingService().lookup(poolInfo, jndiNameForPool, env);
    if (connectorConnectionPool == null) {
        String i18nMsg = localStrings.getString("ccp_adm.null_pool", poolInfo);
        ConnectorRuntimeException cre = new ConnectorRuntimeException(i18nMsg);
        _logger.log(Level.SEVERE, "rardeployment.connectionpool_object_null", poolInfo);
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "", cre);
        }
        throw cre;
    }
    return connectorConnectionPool;
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)

Example 17 with ConnectorRuntimeException

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

the class ConnectorConnectionPoolAdminServiceImpl method reconfigureConnectorConnectionPool.

/**
 * Reconfigure a connection pool.
 * This method compares the passed connector connection pool with the one
 * in memory. If the pools are unequal and the MCF properties are changed
 * a pool recreate is required. However if the pools are unequal and the
 * MCF properties are not changed a recreate is not required
 *
 * @param ccp           - the Updated connector connection pool object that admin
 *                      hands over
 * @param excludedProps - A set of excluded property names that we want
 *                      to be excluded in the comparison check while
 *                      comparing MCF properties
 * @return true - if a pool restart is required, false otherwise
 * @throws ConnectorRuntimeException
 */
public boolean reconfigureConnectorConnectionPool(ConnectorConnectionPool ccp, Set excludedProps) throws ConnectorRuntimeException {
    if (ccp == null) {
        throw new ConnectorRuntimeException("No pool to reconfigure, new pool object is null");
    }
    logFine("new ccp :\n" + ccp.toString());
    // see if the new ConnectorConnectionPool is different from
    // the original one and update relevant properties
    PoolInfo poolInfo = ccp.getPoolInfo();
    ConnectorConnectionPool origCcp = null;
    try {
        origCcp = getOriginalConnectorConnectionPool(poolInfo);
    } catch (NamingException ne) {
        throw new ConnectorRuntimeException(ne.getMessage());
    }
    if (origCcp == null) {
        throw new ConnectorRuntimeException("No pool to reconfigure, original pool object is null");
    }
    logFine("original ccp :\n" + origCcp.toString());
    ConnectionPoolReconfigHelper.ReconfigAction action = ConnectionPoolReconfigHelper.compare(origCcp, ccp, excludedProps);
    logFine("pool reconfig action == " + action);
    if (action == ConnectionPoolReconfigHelper.ReconfigAction.UPDATE_MCF_AND_ATTRIBUTES) {
        updateMCFAndPoolAttributes(ccp);
    } else if (action == ConnectionPoolReconfigHelper.ReconfigAction.RECREATE_POOL) {
        return true;
    }
    return false;
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo) NamingException(javax.naming.NamingException)

Example 18 with ConnectorRuntimeException

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

the class ConnectorConnectionPoolAdminServiceImpl method unloadAndKillPool.

/**
 * unloads and kills the connector Connection pool without checking for
 * resources in domain.xml.
 *
 * @param poolInfo Name of the pool to delete
 * @throws ConnectorRuntimeException if pool unload or kill operation fails
 */
private void unloadAndKillPool(PoolInfo poolInfo) throws ConnectorRuntimeException {
    killPool(poolInfo);
    boolean result = _registry.removeManagedConnectionFactory(poolInfo);
    if (result == false) {
        _logger.log(Level.SEVERE, "rardeployment.mcf_removal_failure", poolInfo);
        String i18nMsg = localStrings.getString("ccp_adm.wrong_params_for_create", poolInfo);
        ConnectorRuntimeException cre = new ConnectorRuntimeException(i18nMsg);
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "", cre);
        }
        throw cre;
    }
    try {
        String jndiNameForPool = ConnectorAdminServiceUtils.getReservePrefixedJNDINameForPool(poolInfo);
        _runtime.getResourceNamingService().unpublishObject(poolInfo, jndiNameForPool);
    } catch (NamingException ne) {
        String i18nMsg = localStrings.getString("ccp_adm.failed_to_remove_from_jndi", poolInfo);
        ConnectorRuntimeException cre = new ConnectorRuntimeException(i18nMsg);
        cre.initCause(ne);
        _logger.log(Level.SEVERE, "rardeployment.connectionpool_removal_from_jndi_error", poolInfo);
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "", cre);
        }
        throw cre;
    }
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) NamingException(javax.naming.NamingException)

Example 19 with ConnectorRuntimeException

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

the class ConnectorConnectionPoolAdminServiceImpl method obtainManagedConnectionFactories.

/**
 * Returns the MCF instances.
 *  @param poolInfo Name of the pool.MCF pertaining to this pool is
 *         created/returned.
 *  @return created/already present MCF instance
 *  @throws ConnectorRuntimeException if creation/retrieval of MCF fails
 */
public ManagedConnectionFactory[] obtainManagedConnectionFactories(PoolInfo poolInfo) throws ConnectorRuntimeException {
    ManagedConnectionFactory[] mcfs = null;
    String raName = null;
    try {
        ConnectorConnectionPool conPool = getConnectorConnectionPool(poolInfo);
        ActiveResourceAdapter activeResourceAdapter = getResourceAdapter(conPool);
        raName = activeResourceAdapter.getModuleName();
        mcfs = activeResourceAdapter.createManagedConnectionFactories(conPool, null);
    } catch (NamingException ne) {
        String i18nMsg = localStrings.getString("pingpool.name_not_bound", poolInfo);
        ConnectorRuntimeException cre = new ConnectorRuntimeException(i18nMsg);
        cre.initCause(ne);
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "rardeployment.jndi_lookup_failed", poolInfo);
            _logger.log(Level.FINE, "", cre);
        }
        // _logger.log(Level.SEVERE,"",cre);
        throw cre;
    } catch (NullPointerException ne) {
        String i18nMsg = localStrings.getString("ccp_adm.failed_to_register_mcf", poolInfo);
        ConnectorRuntimeException cre = new ConnectorRuntimeException(i18nMsg);
        cre.initCause(ne);
        _logger.log(Level.SEVERE, "mcf_add_toregistry_failed", poolInfo);
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "", cre);
        }
        // _logger.log(Level.SEVERE,"",cre);
        throw cre;
    }
    for (ManagedConnectionFactory mcf : mcfs) {
        validateMCF(mcf, raName);
    }
    return mcfs;
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) ManagedConnectionFactory(javax.resource.spi.ManagedConnectionFactory) NamingException(javax.naming.NamingException)

Example 20 with ConnectorRuntimeException

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

the class ActiveResourceAdapterImpl method deleteDefaultConnectorConnectionPools.

/**
 * Deletes the default connector connection pools.
 */
protected void deleteDefaultConnectorConnectionPools() {
    for (ConnectionDefDescriptor aConnectionDefs_ : connectionDefs_) {
        String connectionDefName = aConnectionDefs_.getConnectionFactoryIntf();
        String resourceJndiName = connectorRuntime_.getDefaultPoolName(moduleName_, connectionDefName);
        try {
            PoolInfo poolInfo = new PoolInfo(resourceJndiName);
            connectorRuntime_.deleteConnectorConnectionPool(poolInfo);
        } catch (ConnectorRuntimeException cre) {
            _logger.log(Level.WARNING, "rar.undeployment.default_pool_delete_fail", resourceJndiName);
        }
    }
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) ConnectionDefDescriptor(com.sun.enterprise.deployment.ConnectionDefDescriptor) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo)

Aggregations

ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)71 NamingException (javax.naming.NamingException)16 URISyntaxException (java.net.URISyntaxException)13 PoolInfo (org.glassfish.resourcebase.resources.api.PoolInfo)13 ConnectorDescriptor (com.sun.enterprise.deployment.ConnectorDescriptor)10 PrivilegedActionException (java.security.PrivilegedActionException)9 ExecutionException (java.util.concurrent.ExecutionException)8 ResourceAdapterInternalException (javax.resource.spi.ResourceAdapterInternalException)8 MultiException (org.glassfish.hk2.api.MultiException)8 JmsService (com.sun.enterprise.connectors.jms.config.JmsService)7 ConnectorConfigProperty (com.sun.enterprise.deployment.ConnectorConfigProperty)7 ManagedConnectionFactory (javax.resource.spi.ManagedConnectionFactory)7 ActiveResourceAdapter (com.sun.enterprise.connectors.ActiveResourceAdapter)5 ConnectorRuntime (com.sun.enterprise.connectors.ConnectorRuntime)5 IOException (java.io.IOException)5 ConnectorConnectionPool (com.sun.enterprise.connectors.ConnectorConnectionPool)4 JdbcConnectionPool (org.glassfish.jdbc.config.JdbcConnectionPool)4 ResourceInfo (org.glassfish.resourcebase.resources.api.ResourceInfo)4 Resource (com.sun.enterprise.config.serverbeans.Resource)3 ResourcePool (com.sun.enterprise.config.serverbeans.ResourcePool)3