OPENJPA-2773 set dbcp defaults to align with commons dbcp

Especially the maxIdle=0 was problematic.
It effectively disables the whole pooling, which is counter productive.
This commit is contained in:
Mark Struberg 2019-02-07 09:48:38 +01:00
parent de316bc018
commit fa6ce77004
1 changed files with 5 additions and 4 deletions

View File

@ -188,15 +188,16 @@ extends SimpleDriverDataSource implements Configurable, Closeable {
} }
// set some default properties for DBCP // set some default properties for DBCP
if (hasKey(dbcpProps, "maxActive") == null) {
dbcpProps.setProperty("maxActive", "10");
}
if (hasKey(dbcpProps, "maxIdle") == null) { if (hasKey(dbcpProps, "maxIdle") == null) {
dbcpProps.setProperty("maxIdle", "1"); // by default we set maxIdle to the same value as maxActive.
dbcpProps.setProperty("maxIdle", dbcpProps.getProperty("maxActive"));
} }
if (hasKey(dbcpProps, "minIdle") == null) { if (hasKey(dbcpProps, "minIdle") == null) {
dbcpProps.setProperty("minIdle", "0"); dbcpProps.setProperty("minIdle", "0");
} }
if (hasKey(dbcpProps, "maxActive") == null) {
dbcpProps.setProperty("maxActive", "10");
}
return dbcpProps; return dbcpProps;
} }