Search in sources :

Example 1 with ResourceAdapter

use of com.sun.enterprise.deployment.runtime.connector.ResourceAdapter in project Payara by payara.

the class ConnectionPoolObjectsUtils method createSunRaConnectorPoolObject.

/**
 * Creates ConnectorConnectionPool object pertaining to the pool props
 * mentioned in the sun-ra/xml i.e it represents the pool mentioned in the
 * sun-ra.xm.
 *
 * @param poolInfo Name of the pool
 * @param desc     ConnectorDescriptor which represent ra.xml and sun-ra.xml.
 * @return ConnectorConnectionPool created ConnectorConnectionPool instance
 */
public static ConnectorConnectionPool createSunRaConnectorPoolObject(PoolInfo poolInfo, ConnectorDescriptor desc, String rarName) {
    ConnectorConnectionPool connectorPoolObj = new ConnectorConnectionPool(poolInfo);
    SunConnector sundesc = desc.getSunDescriptor();
    ResourceAdapter sunRAXML = sundesc.getResourceAdapter();
    connectorPoolObj.setMaxPoolSize((String) sunRAXML.getValue(ResourceAdapter.MAX_POOL_SIZE));
    connectorPoolObj.setSteadyPoolSize((String) sunRAXML.getValue(ResourceAdapter.STEADY_POOL_SIZE));
    connectorPoolObj.setMaxWaitTimeInMillis((String) sunRAXML.getValue(ResourceAdapter.MAX_WAIT_TIME_IN_MILLIS));
    connectorPoolObj.setIdleTimeoutInSeconds((String) sunRAXML.getValue(ResourceAdapter.IDLE_TIMEOUT_IN_SECONDS));
    connectorPoolObj.setPoolResizeQuantity((String) "2");
    connectorPoolObj.setFailAllConnections(false);
    // always
    connectorPoolObj.setMatchConnections(true);
    setDefaultAdvancedPoolAttributes(connectorPoolObj);
    try {
        connectorPoolObj.setTransactionSupport(getTransactionSupportFromRaXml(rarName));
    } catch (Exception ex) {
        if (_logger.isLoggable(Level.FINE)) {
            _logger.fine("error in setting txSupport");
        }
    }
    boolean validateAtmostEveryIdleSecs = false;
    // For SunRAPool, get the value of system property VALIDATE_ATMOST_EVERY_IDLE_SECS.
    if (validateAtmostEveryIdleSecsProperty != null && validateAtmostEveryIdleSecsProperty.equalsIgnoreCase("TRUE")) {
        validateAtmostEveryIdleSecs = true;
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "CCP.ValidateAtmostEveryIdleSecs.Set", poolInfo);
        }
    }
    connectorPoolObj.setValidateAtmostEveryIdleSecs(validateAtmostEveryIdleSecs);
    return connectorPoolObj;
}
Also used : ConnectorConnectionPool(com.sun.enterprise.connectors.ConnectorConnectionPool) SunConnector(com.sun.enterprise.deployment.runtime.connector.SunConnector) ResourceAdapter(com.sun.enterprise.deployment.runtime.connector.ResourceAdapter) ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)

Aggregations

ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)1 ConnectorConnectionPool (com.sun.enterprise.connectors.ConnectorConnectionPool)1 ResourceAdapter (com.sun.enterprise.deployment.runtime.connector.ResourceAdapter)1 SunConnector (com.sun.enterprise.deployment.runtime.connector.SunConnector)1