// Pool names should be comma delimited
String[] poolNames = poolList.split(",");
// Initialize each connection pool
for (int i = 0; i < poolNames.length; i++) {
DatastoreConfig config =
s_server.getDatastoreConfig(poolNames[i]);
jdbcDriverClass = config.getParameter("jdbcDriverClass");
dbUsername = config.getParameter("dbUsername");
dbPassword = config.getParameter("dbPassword");
jdbcURL = config.getParameter("jdbcURL");
maxActive =
new Integer(config.getParameter("maxActive"))
.intValue();
maxIdle =
new Integer(config.getParameter("maxIdle")).intValue();
maxWait =
new Integer(config.getParameter("maxWait")).intValue();
minIdle =
new Integer(config.getParameter("minIdle")).intValue();
numTestsPerEvictionRun =
new Integer(config
.getParameter("numTestsPerEvictionRun"))
.intValue();
minEvictableIdleTimeMillis =
new Long(config
.getParameter("minEvictableIdleTimeMillis"))
.longValue();
timeBetweenEvictionRunsMillis =
new Long(config
.getParameter("timeBetweenEvictionRunsMillis"))
.longValue();
validationQuery = config.getParameter("validationQuery");
testOnBorrow =
new Boolean(config.getParameter("testOnBorrow"))
.booleanValue();
testOnReturn =
new Boolean(config.getParameter("testOnReturn"))
.booleanValue();
testWhileIdle =
new Boolean(config.getParameter("testWhileIdle"))
.booleanValue();
whenExhaustedAction =
new Byte(config.getParameter("whenExhaustedAction"))
.byteValue();
if (whenExhaustedAction != 0 && whenExhaustedAction != 1
&& whenExhaustedAction != 2) {
logger.debug("Valid values for whenExhaustedAction are: 0 - (fail), 1 - (block), or 2 - (grow)");
throw new ModuleInitializationException("A connection pool could "
+ "not be instantiated. The underlying error was an "
+ "invalid value for the whenExhaustedAction parameter."
+ "Valid values are 0 - (fail), 1 - (block), or 2 - (grow). Value specified"
+ "was \"" + whenExhaustedAction + "\".", getRole());
}
if (logger.isDebugEnabled()) {
logger.debug("poolName[" + i + "] = " + poolNames[i]);
logger.debug("JDBC driver: " + jdbcDriverClass);
logger.debug("Database username: " + dbUsername);
logger.debug("Database password: " + dbPassword);
logger.debug("JDBC connection URL: " + jdbcURL);
logger.debug("Maximum active connections: " + maxActive);
logger.debug("Maximum idle connections: " + maxIdle);
logger.debug("Maximum wait time: " + maxWait);
logger.debug("Minimum idle time: " + minIdle);
logger.debug("Number of tests per eviction run: "
+ numTestsPerEvictionRun);
logger.debug("Minimum Evictable Idle time: "
+ minEvictableIdleTimeMillis);
logger.debug("Minimum Evictable Idle time: "
+ timeBetweenEvictionRunsMillis);
logger.debug("Validation query: " + validationQuery);
logger.debug("Test on borrow: " + testOnBorrow);
logger.debug("Test on return: " + testOnReturn);
logger.debug("Test while idle: " + testWhileIdle);
logger.debug("whenExhaustedAction: " + whenExhaustedAction);
}
// Treat any parameters whose names start with "connection."
// as connection parameters
Map<String, String> cProps = new HashMap<String, String>();
for (String name : config.getParameters().keySet()) {
if (name.startsWith("connection.")) {
String realName = name.substring(11);
logger.debug("Connection property " + realName + " = "
+ config.getParameter(name));
cProps.put(realName, config.getParameter(name));
}
}
// If a ddlConverter has been specified for the pool,
// try to instantiate it so the ConnectionPool can use