Search in sources :

Example 46 with PoolInfo

use of org.glassfish.resourcebase.resources.api.PoolInfo in project Payara by payara.

the class JdbcConnPoolStatsProvider method connectionRequestServedEvent.

/**
 * Event that a connection request is served in timeTakenInMillis.
 *
 * @param poolName
 * @param timeTakenInMillis
 */
@ProbeListener(JDBC_PROBE_LISTENER + "connectionRequestServedEvent")
public void connectionRequestServedEvent(@ProbeParam("poolName") String poolName, @ProbeParam("appName") String appName, @ProbeParam("moduleName") String moduleName, @ProbeParam("timeTakenInMillis") long timeTakenInMillis) {
    PoolInfo poolInfo = new PoolInfo(poolName, appName, moduleName);
    if (this.poolInfo.equals(poolInfo)) {
        if (logger.isLoggable(Level.FINEST)) {
            logger.finest("Connection request served event received - " + "poolName = " + poolName);
        }
        connRequestWaitTime.setCurrent(timeTakenInMillis);
        totalConnRequestWaitTime.increment(timeTakenInMillis);
    }
}
Also used : PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo) ProbeListener(org.glassfish.external.probe.provider.annotations.ProbeListener)

Example 47 with PoolInfo

use of org.glassfish.resourcebase.resources.api.PoolInfo in project Payara by payara.

the class JdbcConnectionPoolDeployer method handlePoolRecreationForExistingProxies.

private void handlePoolRecreationForExistingProxies(ConnectorConnectionPool connConnPool) {
    recreatePool(connConnPool);
    Collection<BindableResource> resourcesList;
    if (!connConnPool.isApplicationScopedResource()) {
        resourcesList = JdbcResourcesUtil.getResourcesOfPool(domain.getResources(), connConnPool.getName());
    } else {
        PoolInfo poolInfo = connConnPool.getPoolInfo();
        Resources resources = ResourcesUtil.createInstance().getResources(poolInfo);
        resourcesList = JdbcResourcesUtil.getResourcesOfPool(resources, connConnPool.getName());
    }
    for (BindableResource bindableResource : resourcesList) {
        ResourceInfo resourceInfo = ConnectorsUtil.getResourceInfo(bindableResource);
        ConnectorRegistry.getInstance().updateResourceInfoVersion(resourceInfo);
    }
}
Also used : ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) BindableResource(com.sun.enterprise.config.serverbeans.BindableResource) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo) Resources(com.sun.enterprise.config.serverbeans.Resources)

Example 48 with PoolInfo

use of org.glassfish.resourcebase.resources.api.PoolInfo in project Payara by payara.

the class JdbcConnectionPoolDeployer method undeployResource.

/**
 * {@inheritDoc}
 */
@Override
public void undeployResource(Object resource, String applicationName, String moduleName) throws Exception {
    JdbcConnectionPool jdbcConnPool = (JdbcConnectionPool) resource;
    PoolInfo poolInfo = new PoolInfo(jdbcConnPool.getName(), applicationName, moduleName);
    if (_logger.isLoggable(Level.FINE)) {
        _logger.fine(" JdbcConnectionPoolDeployer - unDeployResource : " + "calling actualUndeploy of " + poolInfo);
    }
    actualUndeployResource(poolInfo);
}
Also used : JdbcConnectionPool(org.glassfish.jdbc.config.JdbcConnectionPool) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo)

Example 49 with PoolInfo

use of org.glassfish.resourcebase.resources.api.PoolInfo in project Payara by payara.

the class JdbcConnectionPoolDeployer method redeployResource.

/**
 * {@inheritDoc}
 */
@Override
public synchronized void redeployResource(Object resource) throws Exception {
    final JdbcConnectionPool adminPool = (JdbcConnectionPool) resource;
    PoolInfo poolInfo = ConnectorsUtil.getPoolInfo(adminPool);
    if (!runtime.isConnectorConnectionPoolDeployed(poolInfo)) {
        if (_logger.isLoggable(Level.FINE)) {
            _logger.fine("The JDBC connection pool " + poolInfo + " is not referred or not yet created in this server " + "instance and hence pool redeployment is ignored");
        }
        return;
    }
    final ConnectorConnectionPool connConnPool = createConnectorConnectionPool(adminPool, poolInfo);
    if (connConnPool == null) {
        throw new ConnectorRuntimeException("Unable to create ConnectorConnectionPool" + "from JDBC connection pool");
    }
    // now do internal book keeping
    HashSet excludes = new HashSet();
    // add MCF config props to the set that need to be excluded
    // in checking for the equality of the props with old pool
    excludes.add("TransactionIsolation");
    excludes.add("GuaranteeIsolationLevel");
    excludes.add("ValidationTableName");
    excludes.add("ConnectionValidationRequired");
    excludes.add("ValidationMethod");
    excludes.add("StatementWrapping");
    excludes.add("StatementTimeout");
    excludes.add("ValidationClassName");
    excludes.add("StatementCacheSize");
    excludes.add("StatementCacheType");
    excludes.add("StatementLeakTimeoutInSeconds");
    excludes.add("StatementLeakReclaim");
    try {
        if (_logger.isLoggable(Level.FINEST)) {
            _logger.finest("Calling reconfigure pool");
        }
        boolean requirePoolRecreation = runtime.reconfigureConnectorConnectionPool(connConnPool, excludes);
        if (requirePoolRecreation) {
            if (runtime.isServer() || runtime.isEmbedded()) {
                handlePoolRecreation(connConnPool);
            } else {
                recreatePool(connConnPool);
            }
        }
    } catch (ConnectorRuntimeException cre) {
        Object[] params = new Object[] { poolInfo, cre };
        _logger.log(Level.WARNING, "error.redeploying.jdbc.pool", params);
        throw cre;
    }
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) ConnectorConnectionPool(com.sun.enterprise.connectors.ConnectorConnectionPool) JdbcConnectionPool(org.glassfish.jdbc.config.JdbcConnectionPool) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo) HashSet(java.util.HashSet)

Example 50 with PoolInfo

use of org.glassfish.resourcebase.resources.api.PoolInfo in project Payara by payara.

the class JdbcConnectionPoolDeployer method deployResource.

/**
 * {@inheritDoc}
 */
@Override
public void deployResource(Object resource) throws Exception {
    JdbcConnectionPool jcp = (JdbcConnectionPool) resource;
    PoolInfo poolInfo = ConnectorsUtil.getPoolInfo(jcp);
    actualDeployResource(resource, poolInfo);
}
Also used : JdbcConnectionPool(org.glassfish.jdbc.config.JdbcConnectionPool) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo)

Aggregations

PoolInfo (org.glassfish.resourcebase.resources.api.PoolInfo)52 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)17 ResourceInfo (org.glassfish.resourcebase.resources.api.ResourceInfo)15 NamingException (javax.naming.NamingException)10 JdbcConnectionPool (org.glassfish.jdbc.config.JdbcConnectionPool)9 ConnectorConnectionPool (com.sun.enterprise.connectors.ConnectorConnectionPool)7 ManagedConnectionFactory (javax.resource.spi.ManagedConnectionFactory)7 ProbeListener (org.glassfish.external.probe.provider.annotations.ProbeListener)7 ResourceException (javax.resource.ResourceException)6 Property (org.jvnet.hk2.config.types.Property)5 PoolingException (com.sun.appserv.connectors.internal.api.PoolingException)4 Resources (com.sun.enterprise.config.serverbeans.Resources)4 ConnectionDefDescriptor (com.sun.enterprise.deployment.ConnectionDefDescriptor)4 ConnectorConfigProperty (com.sun.enterprise.deployment.ConnectorConfigProperty)4 ArrayList (java.util.ArrayList)4 JdbcResource (org.glassfish.jdbc.config.JdbcResource)4 ConnectorRegistry (com.sun.enterprise.connectors.ConnectorRegistry)3 ConnectorRuntime (com.sun.enterprise.connectors.ConnectorRuntime)3 ResourcePrincipal (com.sun.enterprise.deployment.ResourcePrincipal)3 ActionReport (org.glassfish.api.ActionReport)3