Search in sources :

Example 36 with PoolInfo

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

the class ConnectorConnectionPoolDeployer method deployResource.

/**
 * {@inheritDoc}
 */
public void deployResource(Object resource) throws Exception {
    org.glassfish.connectors.config.ConnectorConnectionPool ccp = (org.glassfish.connectors.config.ConnectorConnectionPool) resource;
    PoolInfo poolInfo = ConnectorsUtil.getPoolInfo(ccp);
    deployResource(resource, poolInfo.getApplicationName(), poolInfo.getModuleName());
}
Also used : ConnectorConnectionPool(com.sun.enterprise.connectors.ConnectorConnectionPool) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo)

Example 37 with PoolInfo

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

the class ConnectorConnectionPoolDeployer method redeployResource.

/**
 * {@inheritDoc}
 */
public synchronized void redeployResource(Object resource) throws Exception {
    // Connector connection pool reconfiguration or
    // change in security maps
    org.glassfish.connectors.config.ConnectorConnectionPool domainCcp = (org.glassfish.connectors.config.ConnectorConnectionPool) resource;
    List<SecurityMap> securityMaps = domainCcp.getSecurityMap();
    // Since 8.1 PE/SE/EE, only if pool has already been deployed in this
    // server-instance earlier, reconfig this pool
    PoolInfo poolInfo = ConnectorsUtil.getPoolInfo(domainCcp);
    if (!runtime.isConnectorConnectionPoolDeployed(poolInfo)) {
        if (_logger.isLoggable(Level.FINE)) {
            _logger.fine("The connector connection pool " + poolInfo + " is either not referred or not yet created in " + "this server instance and pool and hence " + "redeployment is ignored");
        }
        return;
    }
    String rarName = domainCcp.getResourceAdapterName();
    String connDefName = domainCcp.getConnectionDefinitionName();
    List<Property> props = domainCcp.getProperty();
    ConnectorConnectionPool ccp = getConnectorConnectionPool(domainCcp, poolInfo);
    populateConnectorConnectionPool(ccp, connDefName, rarName, props, securityMaps);
    boolean poolRecreateRequired = false;
    try {
        if (_logger.isLoggable(Level.FINE)) {
            _logger.fine("Calling reconfigure pool");
        }
        poolRecreateRequired = runtime.reconfigureConnectorConnectionPool(ccp, new HashSet());
    } catch (ConnectorRuntimeException cre) {
        Object[] params = new Object[] { poolInfo, cre };
        _logger.log(Level.WARNING, "error.reconfiguring.pool", params);
    }
    if (poolRecreateRequired) {
        if (_logger.isLoggable(Level.FINE)) {
            _logger.fine("Pool recreation required");
        }
        runtime.recreateConnectorConnectionPool(ccp);
        if (_logger.isLoggable(Level.FINE)) {
            _logger.fine("Pool recreation done");
        }
    }
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) ConnectorConnectionPool(com.sun.enterprise.connectors.ConnectorConnectionPool) SecurityMap(org.glassfish.connectors.config.SecurityMap) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo) ConnectorConfigProperty(com.sun.enterprise.deployment.ConnectorConfigProperty) Property(org.jvnet.hk2.config.types.Property)

Example 38 with PoolInfo

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

the class ConnectorConnectionPoolDeployer method undeployResource.

/**
 * {@inheritDoc}
 */
public synchronized void undeployResource(Object resource) 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 = ConnectorsUtil.getPoolInfo(domainCcp);
    actualUndeployResource(domainCcp, poolInfo);
}
Also used : ConnectorConnectionPool(com.sun.enterprise.connectors.ConnectorConnectionPool) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo)

Example 39 with PoolInfo

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

the class ConnectorConnectionPoolDeployer method deployResource.

/**
 * {@inheritDoc}
 */
public void deployResource(Object resource, String applicationName, String moduleName) throws Exception {
    if (_logger.isLoggable(Level.FINE)) {
        _logger.fine("ConnectorConnectionPoolDeployer : deployResource ");
    }
    final org.glassfish.connectors.config.ConnectorConnectionPool domainCcp = (org.glassfish.connectors.config.ConnectorConnectionPool) resource;
    // redirect call to redeployResource
    if (ConnectionPoolObjectsUtils.isPoolSystemPool(domainCcp)) {
        this.redeployResource(resource);
        return;
    }
    PoolInfo poolInfo = new PoolInfo(domainCcp.getName(), applicationName, moduleName);
    final ConnectorConnectionPool ccp = getConnectorConnectionPool(domainCcp, poolInfo);
    String rarName = domainCcp.getResourceAdapterName();
    String connDefName = domainCcp.getConnectionDefinitionName();
    List<Property> props = domainCcp.getProperty();
    List<SecurityMap> securityMaps = domainCcp.getSecurityMap();
    populateConnectorConnectionPool(ccp, connDefName, rarName, props, securityMaps);
    final String defName = domainCcp.getConnectionDefinitionName();
    if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE, "Calling backend to add connectorConnectionPool", domainCcp.getResourceAdapterName());
    }
    runtime.createConnectorConnectionPool(ccp, defName, domainCcp.getResourceAdapterName(), domainCcp.getProperty(), domainCcp.getSecurityMap());
    if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE, "Added connectorConnectionPool in backend", domainCcp.getResourceAdapterName());
    }
}
Also used : ConnectorConnectionPool(com.sun.enterprise.connectors.ConnectorConnectionPool) SecurityMap(org.glassfish.connectors.config.SecurityMap) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo) ConnectorConfigProperty(com.sun.enterprise.deployment.ConnectorConfigProperty) Property(org.jvnet.hk2.config.types.Property)

Example 40 with PoolInfo

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

the class ConnectorConnPoolStatsProvider method connectionsFreedEvent.

/**
 * Connections freed event
 * @param poolName
 * @param count number of connections freed to the pool
 */
@ProbeListener(JCA_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)

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