use of com.sun.enterprise.connectors.ConnectorConnectionPool in project Payara by payara.
the class ConnectionPoolObjectsUtils method createDefaultConnectorPoolObject.
/**
* Creates default ConnectorConnectionPool consisting of default
* pool values.
*
* @param poolInfo Name of the pool
* @return ConnectorConnectionPool created ConnectorConnectionPool instance
*/
public static ConnectorConnectionPool createDefaultConnectorPoolObject(PoolInfo poolInfo, String rarName) {
ConnectorConnectionPool connectorPoolObj = new ConnectorConnectionPool(poolInfo);
connectorPoolObj.setMaxPoolSize("20");
connectorPoolObj.setSteadyPoolSize("10");
connectorPoolObj.setMaxWaitTimeInMillis("7889");
connectorPoolObj.setIdleTimeoutInSeconds("789");
connectorPoolObj.setPoolResizeQuantity("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");
}
}
return connectorPoolObj;
}
use of com.sun.enterprise.connectors.ConnectorConnectionPool 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");
}
}
}
use of com.sun.enterprise.connectors.ConnectorConnectionPool in project Payara by payara.
the class ConnectorConnectionPoolDeployer method getConnectorConnectionPool.
private ConnectorConnectionPool getConnectorConnectionPool(org.glassfish.connectors.config.ConnectorConnectionPool domainCcp, PoolInfo poolInfo) throws Exception {
ConnectorConnectionPool ccp;
ccp = new ConnectorConnectionPool(poolInfo);
ccp.setSteadyPoolSize(domainCcp.getSteadyPoolSize());
ccp.setMaxPoolSize(domainCcp.getMaxPoolSize());
ccp.setMaxWaitTimeInMillis(domainCcp.getMaxWaitTimeInMillis());
ccp.setPoolResizeQuantity(domainCcp.getPoolResizeQuantity());
ccp.setIdleTimeoutInSeconds(domainCcp.getIdleTimeoutInSeconds());
ccp.setFailAllConnections(Boolean.valueOf(domainCcp.getFailAllConnections()));
ccp.setAuthCredentialsDefinedInPool(isAuthCredentialsDefinedInPool(domainCcp));
// The line below will change for 9.0. We will get this from
// the domain.xml
ccp.setConnectionValidationRequired(Boolean.valueOf(domainCcp.getIsConnectionValidationRequired()));
String txSupport = domainCcp.getTransactionSupport();
int txSupportIntVal = parseTransactionSupportString(txSupport);
if (txSupportIntVal == -1) {
// from the ra.xml
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("Got transaction-support attr null from domain.xml");
}
txSupportIntVal = ConnectionPoolObjectsUtils.getTransactionSupportFromRaXml(domainCcp.getResourceAdapterName());
} else {
// the value specified in the ra.xml
if (!ConnectionPoolObjectsUtils.isTxSupportConfigurationSane(txSupportIntVal, domainCcp.getResourceAdapterName())) {
String i18nMsg = localStrings.getString("ccp_deployer.incorrect_tx_support");
ConnectorRuntimeException cre = new ConnectorRuntimeException(i18nMsg);
_logger.log(Level.SEVERE, "rardeployment.incorrect_tx_support", ccp.getName());
throw cre;
}
}
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("setting txSupportVal to " + txSupportIntVal + " in pool " + domainCcp.getName());
}
ccp.setTransactionSupport(txSupportIntVal);
// Always for ccp
ccp.setNonComponent(false);
ccp.setNonTransactional(false);
ccp.setConnectionLeakTracingTimeout(domainCcp.getConnectionLeakTimeoutInSeconds());
ccp.setConnectionReclaim(Boolean.valueOf(domainCcp.getConnectionLeakReclaim()));
ccp.setMatchConnections(Boolean.valueOf(domainCcp.getMatchConnections()));
ccp.setAssociateWithThread(Boolean.valueOf(domainCcp.getAssociateWithThread()));
ccp.setPooling(Boolean.valueOf(domainCcp.getPooling()));
ccp.setPingDuringPoolCreation(Boolean.valueOf(domainCcp.getPing()));
boolean lazyConnectionEnlistment = Boolean.valueOf(domainCcp.getLazyConnectionEnlistment());
boolean lazyConnectionAssociation = Boolean.valueOf(domainCcp.getLazyConnectionAssociation());
if (lazyConnectionAssociation) {
if (lazyConnectionEnlistment) {
ccp.setLazyConnectionAssoc(true);
ccp.setLazyConnectionEnlist(true);
} else {
_logger.log(Level.SEVERE, "conn_pool_obj_utils.lazy_enlist-lazy_assoc-invalid-combination", domainCcp.getName());
String i18nMsg = localStrings.getString("cpou.lazy_enlist-lazy_assoc-invalid-combination", domainCcp.getName());
throw new RuntimeException(i18nMsg);
}
} else {
ccp.setLazyConnectionAssoc(lazyConnectionAssociation);
ccp.setLazyConnectionEnlist(lazyConnectionEnlistment);
}
boolean pooling = Boolean.valueOf(domainCcp.getPooling());
// TODO: should this be added to the beginning of this method?
if (!pooling) {
// Throw exception if assoc with thread is set to true.
if (Boolean.valueOf(domainCcp.getAssociateWithThread())) {
_logger.log(Level.SEVERE, "conn_pool_obj_utils.pooling_disabled_assocwiththread_invalid_combination", domainCcp.getName());
String i18nMsg = localStrings.getString("cpou.pooling_disabled_assocwiththread_invalid_combination", domainCcp.getName());
throw new RuntimeException(i18nMsg);
}
// match-connections/max-connection-usage-count/idele-timeout
if (Boolean.valueOf(domainCcp.getIsConnectionValidationRequired())) {
_logger.log(Level.WARNING, "conn_pool_obj_utils.pooling_disabled_conn_validation_invalid_combination", domainCcp.getName());
}
if (Integer.parseInt(domainCcp.getValidateAtmostOncePeriodInSeconds()) > 0) {
_logger.log(Level.WARNING, "conn_pool_obj_utils.pooling_disabled_validate_atmost_once_invalid_combination", domainCcp.getName());
}
if (Boolean.valueOf(domainCcp.getMatchConnections())) {
_logger.log(Level.WARNING, "conn_pool_obj_utils.pooling_disabled_match_connections_invalid_combination", domainCcp.getName());
}
if (Integer.parseInt(domainCcp.getMaxConnectionUsageCount()) > 0) {
_logger.log(Level.WARNING, "conn_pool_obj_utils.pooling_disabled_max_conn_usage_invalid_combination", domainCcp.getName());
}
if (Integer.parseInt(domainCcp.getIdleTimeoutInSeconds()) > 0) {
_logger.log(Level.WARNING, "conn_pool_obj_utils.pooling_disabled_idle_timeout_invalid_combination", domainCcp.getName());
}
}
ccp.setPooling(pooling);
ccp.setMaxConnectionUsage(domainCcp.getMaxConnectionUsageCount());
ccp.setValidateAtmostOncePeriod(domainCcp.getValidateAtmostOncePeriodInSeconds());
ccp.setConCreationRetryAttempts(domainCcp.getConnectionCreationRetryAttempts());
ccp.setConCreationRetryInterval(domainCcp.getConnectionCreationRetryIntervalInSeconds());
// IMPORTANT
// Here all properties that will be checked by the
// convertElementPropertyToPoolProperty method need to be set to
// their default values
convertElementPropertyToPoolProperty(ccp, domainCcp);
return ccp;
}
use of com.sun.enterprise.connectors.ConnectorConnectionPool 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());
}
}
use of com.sun.enterprise.connectors.ConnectorConnectionPool in project Payara by payara.
the class ConnectionPool method getPoolConfigurationFromJndi.
protected ConnectorConnectionPool getPoolConfigurationFromJndi(Hashtable env) throws PoolingException {
ConnectorConnectionPool poolResource;
try {
String jndiNameOfPool = ConnectorAdminServiceUtils.getReservePrefixedJNDINameForPool(poolInfo);
poolResource = (ConnectorConnectionPool) ConnectorRuntime.getRuntime().getResourceNamingService().lookup(poolInfo, jndiNameOfPool, env);
} catch (NamingException ex) {
throw new PoolingException(ex);
}
return poolResource;
}
Aggregations