use of com.sun.enterprise.connectors.ConnectorConnectionPool in project Payara by payara.
the class JdbcConnectionPoolDeployer method createConnectorConnectionPool.
public ConnectorConnectionPool createConnectorConnectionPool(JdbcConnectionPool adminPool, PoolInfo poolInfo) throws ConnectorRuntimeException {
String moduleName = JdbcResourcesUtil.createInstance().getRANameofJdbcConnectionPool(adminPool);
int txSupport = getTxSupport(moduleName);
ConnectorDescriptor connDesc = runtime.getConnectorDescriptor(moduleName);
// Create the connector Connection Pool object from the configbean object
ConnectorConnectionPool conConnPool = new ConnectorConnectionPool(poolInfo);
conConnPool.setTransactionSupport(txSupport);
setConnectorConnectionPoolAttributes(conConnPool, adminPool);
// Initially create the ConnectorDescriptor
ConnectorDescriptorInfo connDescInfo = createConnectorDescriptorInfo(connDesc, moduleName);
connDescInfo.setMCFConfigProperties(getMCFConfigProperties(adminPool, conConnPool, connDesc));
// since we are deploying a 1.0 RAR, this is null
connDescInfo.setResourceAdapterConfigProperties((Set) null);
conConnPool.setConnectorDescriptorInfo(connDescInfo);
return conConnPool;
}
use of com.sun.enterprise.connectors.ConnectorConnectionPool 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;
}
}
use of com.sun.enterprise.connectors.ConnectorConnectionPool in project Payara by payara.
the class JdbcAdminServiceImpl method getDefaultDatabaseName.
/**
* Returns a databaseName that is populated in pool's default DATABASENAME
* @param poolInfo
* @param mcf
* @return
* @throws javax.naming.NamingException if poolName lookup fails
*/
private String getDefaultDatabaseName(PoolInfo poolInfo, ManagedConnectionFactory mcf) throws NamingException {
// All this to get the default user name and principal
String databaseName = null;
ConnectorConnectionPool connectorConnectionPool = null;
try {
String jndiNameForPool = ConnectorAdminServiceUtils.getReservePrefixedJNDINameForPool(poolInfo);
connectorConnectionPool = (ConnectorConnectionPool) _runtime.getResourceNamingService().lookup(poolInfo, jndiNameForPool, null);
} catch (NamingException ne) {
throw ne;
}
databaseName = ccPoolAdmService.getPropertyValue("DATABASENAME", connectorConnectionPool);
// the databasename from MCF.
if (databaseName == null || databaseName.trim().equals("")) {
databaseName = ConnectionPoolObjectsUtils.getValueFromMCF("DatabaseName", poolInfo, mcf);
}
return databaseName;
}
Aggregations