Search in sources :

Example 21 with PoolInfo

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

the class ConnectorConnectionPoolDeployer method undeployResource.

/**
 * {@inheritDoc}
 */
public void undeployResource(Object resource, String applicationName, String moduleName) throws Exception {
    if (_logger.isLoggable(Level.FINE)) {
        _logger.fine("ConnectorConnectionPoolDeployer : undeployResource : ");
    }
    final org.glassfish.connectors.config.ConnectorConnectionPool domainCcp = (org.glassfish.connectors.config.ConnectorConnectionPool) resource;
    PoolInfo poolInfo = new PoolInfo(domainCcp.getName(), applicationName, moduleName);
    actualUndeployResource(domainCcp, poolInfo);
}
Also used : ConnectorConnectionPool(com.sun.enterprise.connectors.ConnectorConnectionPool) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo)

Example 22 with PoolInfo

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

the class JdbcResourceDeployer method deployResource.

/**
 * {@inheritDoc}
 */
@Override
public synchronized void deployResource(Object resource, String applicationName, String moduleName) throws Exception {
    // deployResource is not synchronized as there is only one caller
    // ResourceProxy which is synchronized
    JdbcResource jdbcRes = (JdbcResource) resource;
    String jndiName = jdbcRes.getJndiName();
    String poolName = jdbcRes.getPoolName();
    PoolInfo poolInfo = new PoolInfo(poolName, applicationName, moduleName);
    ResourceInfo resourceInfo = new ResourceInfo(jndiName, applicationName, moduleName);
    runtime.createConnectorResource(resourceInfo, poolInfo, null);
    // In-case the resource is explicitly created with a suffix (__nontx or __PM), no need to create one
    if (ConnectorsUtil.getValidSuffix(jndiName) == null) {
        ResourceInfo pmResourceInfo = new ResourceInfo(ConnectorsUtil.getPMJndiName(jndiName), resourceInfo.getApplicationName(), resourceInfo.getModuleName());
        runtime.createConnectorResource(pmResourceInfo, poolInfo, null);
    }
    if (_logger.isLoggable(Level.FINEST)) {
        _logger.finest("deployed resource " + jndiName);
    }
}
Also used : ResourceInfo(org.glassfish.resourcebase.resources.api.ResourceInfo) JdbcResource(org.glassfish.jdbc.config.JdbcResource) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo)

Example 23 with PoolInfo

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

the class JdbcConnPoolStatsProvider method decrementNumConnFreeEvent.

/**
 * Decrement numconnfree event
 * @param poolName
 * @param steadyPoolSize
 */
@ProbeListener(JDBC_PROBE_LISTENER + "decrementNumConnFreeEvent")
public void decrementNumConnFreeEvent(@ProbeParam("poolName") String poolName, @ProbeParam("appName") String appName, @ProbeParam("moduleName") String moduleName) {
    // handle the num conn free decrement event
    PoolInfo poolInfo = new PoolInfo(poolName, appName, moduleName);
    if (this.poolInfo.equals(poolInfo)) {
        if (logger.isLoggable(Level.FINEST)) {
            logger.finest("Decrement Num Connections Free event received - poolName = " + poolName);
        }
        // Decrement counter
        synchronized (numConnFree) {
            long numConnFreeSafe = (numConnFree.getCurrent() - 1 >= 0) ? numConnFree.getCurrent() - 1 : 0;
            numConnFree.setCurrent(numConnFreeSafe);
        }
    }
}
Also used : PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo) ProbeListener(org.glassfish.external.probe.provider.annotations.ProbeListener)

Example 24 with PoolInfo

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

the class JdbcConnPoolStatsProvider method connectionsFreedEvent.

/**
 * Connections freed event
 * @param poolName
 * @param count number of connections freed to the pool
 */
@ProbeListener(JDBC_PROBE_LISTENER + "connectionsFreedEvent")
public void connectionsFreedEvent(@ProbeParam("poolName") String poolName, @ProbeParam("appName") String appName, @ProbeParam("moduleName") String moduleName, @ProbeParam("count") int count) {
    // handle the connections freed event
    PoolInfo poolInfo = new PoolInfo(poolName, appName, moduleName);
    if (this.poolInfo.equals(poolInfo)) {
        if (logger.isLoggable(Level.FINEST)) {
            logger.finest("Connections Freed event received - poolName = " + poolName);
            logger.finest("numConnUsed =" + numConnUsed.getCurrent() + " numConnFree=" + numConnFree.getCurrent() + " Number of connections freed =" + count);
        }
        // set numConnFree to the count value
        synchronized (numConnFree) {
            numConnFree.setCurrent(count);
        }
    }
}
Also used : PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo) ProbeListener(org.glassfish.external.probe.provider.annotations.ProbeListener)

Example 25 with PoolInfo

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

the class GetValidationTableNames method execute.

/**
 * @inheritDoc
 */
public void execute(AdminCommandContext context) {
    final ActionReport report = context.getActionReport();
    try {
        PoolInfo poolInfo = new PoolInfo(poolName, applicationName, moduleName);
        Set<String> validationTableNames = jdbcAdminService.getValidationTableNames(poolInfo);
        Properties extraProperties = new Properties();
        extraProperties.put("validationTableNames", new ArrayList(validationTableNames));
        report.setExtraProperties(extraProperties);
    } catch (Exception e) {
        report.setMessage("_get-validation-table-names failed : " + e.getMessage());
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        report.setFailureCause(e);
        return;
    }
    ActionReport.ExitCode ec = ActionReport.ExitCode.SUCCESS;
    report.setActionExitCode(ec);
}
Also used : ArrayList(java.util.ArrayList) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo) ActionReport(org.glassfish.api.ActionReport) Properties(java.util.Properties)

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