This is an automated email from the ASF dual-hosted git repository.

struberg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openjpa.git

commit fa6ce77004739d9601bfde43e06f9446ab601698
Author: Mark Struberg <[email protected]>
AuthorDate: Thu Feb 7 09:48:38 2019 +0100

    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.
---
 .../org/apache/openjpa/jdbc/schema/DBCPDriverDataSource.java     | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git 
a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DBCPDriverDataSource.java
 
b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DBCPDriverDataSource.java
index c2d28e4..eaf68b4 100644
--- 
a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DBCPDriverDataSource.java
+++ 
b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DBCPDriverDataSource.java
@@ -188,15 +188,16 @@ extends SimpleDriverDataSource implements Configurable, 
Closeable {
         }
 
         // set some default properties for DBCP
+        if (hasKey(dbcpProps, "maxActive") == null) {
+            dbcpProps.setProperty("maxActive", "10");
+        }
         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) {
             dbcpProps.setProperty("minIdle", "0");
         }
-        if (hasKey(dbcpProps, "maxActive") == null) {
-            dbcpProps.setProperty("maxActive", "10");
-        }
 
         return dbcpProps;
     }

Reply via email to