You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2009/09/20 21:14:42 UTC
svn commit: r817082 - in /ofbiz/trunk/framework/entity:
config/entityengine.xml dtd/entity-config.xsd
src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
Author: jleroux
Date: Sun Sep 20 19:14:41 2009
New Revision: 817082
URL: http://svn.apache.org/viewvc?rev=817082&view=rev
Log:
Allow to set timeBetweenEvictionRunsMillis for each DB type from entityengine.xml. Keep default value at 600000 (10 min)
Modified:
ofbiz/trunk/framework/entity/config/entityengine.xml
ofbiz/trunk/framework/entity/dtd/entity-config.xsd
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
Modified: ofbiz/trunk/framework/entity/config/entityengine.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/config/entityengine.xml?rev=817082&r1=817081&r2=817082&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/config/entityengine.xml (original)
+++ ofbiz/trunk/framework/entity/config/entityengine.xml Sun Sep 20 19:14:41 2009
@@ -143,7 +143,8 @@
jdbc-password=""
isolation-level="ReadUncommitted"
pool-minsize="2"
- pool-maxsize="250"/>
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/>
<!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/HsqlDataSource" isolation-level="ReadUncommitted"/> -->
<!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/env/jdbc/xa/localhsql" isolation-level="ReadUncommitted"/> --> <!-- Orion Style JNDI name -->
<!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="localhsqlDataSource"/> --> <!-- Weblogic Style JNDI name -->
@@ -169,7 +170,8 @@
jdbc-password="ofbiz"
isolation-level="ReadCommitted"
pool-minsize="2"
- pool-maxsize="250"/>
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/>
<!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
</datasource>
<datasource name="localderbyodbc"
@@ -188,7 +190,8 @@
jdbc-password="ofbiz"
isolation-level="ReadCommitted"
pool-minsize="2"
- pool-maxsize="250"/>
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/>
<!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
</datasource>
<datasource name="localderbyolap"
@@ -211,7 +214,8 @@
jdbc-password="ofbiz"
isolation-level="ReadCommitted"
pool-minsize="2"
- pool-maxsize="250"/>
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/>
<!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
</datasource>
@@ -231,7 +235,8 @@
jdbc-password="ofbiz"
isolation-level="ReadCommitted"
pool-minsize="2"
- pool-maxsize="250"/>
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/>
<!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/CloudscapeDataSource" isolation-level="Serializable"/> -->
</datasource>
@@ -253,7 +258,8 @@
jdbc-password="ofbiz"
isolation-level="ReadCommitted"
pool-minsize="2"
- pool-maxsize="250"/>
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/>
<!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/DaffodilDataSource" isolation-level="ReadCommitted"/> -->
</datasource>
@@ -274,7 +280,8 @@
jdbc-password="ofbiz"
isolation-level="ReadCommitted"
pool-minsize="2"
- pool-maxsize="250"/>
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/>
</datasource>
<datasource name="localmysql"
@@ -301,7 +308,10 @@
jdbc-password="ofbiz"
isolation-level="ReadCommitted"
pool-minsize="2"
- pool-maxsize="250"/>
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/><!-- Please note that at least one person has experienced a problem with this value with MySQL
+ and had to set it to -1 in order to avoid this issue.
+ For more look at http://markmail.org/thread/5sivpykv7xkl66px and http://commons.apache.org/dbcp/configuration.html-->
<!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
</datasource>
<datasource name="odbcmysql"
@@ -325,7 +335,8 @@
jdbc-password="ofbiz"
isolation-level="ReadCommitted"
pool-minsize="2"
- pool-maxsize="250"/>
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/>
<!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
</datasource>
@@ -353,9 +364,10 @@
jdbc-password="ofbiz"
isolation-level="ReadCommitted"
pool-minsize="2"
- pool-maxsize="250"/><!-- Be warned that at this date (2009-06-09) the max_connections parameters in postgresql.conf
- is set by default to 100 by the initdb process see http://www.postgresql.org/docs/8.3/static/runtime-config-connection.html#GUC-MAX-CONNECTIONS-->
-
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/><!-- Be warned that at this date (2009-09-20) the max_connections parameters in postgresql.conf
+ is set by default to 100 by the initdb process see http://www.postgresql.org/docs/8.4/static/runtime-config-connection.html#GUC-MAX-CONNECTIONS-->
+
<!-- <jndi-jdbc jndi-server-name="default" jndi-name="java:comp/env/jdbc/localpostgres" isolation-level="ReadCommitted"/>-->
<!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/env/jdbc/xa/localpostgres" isolation-level="ReadCommitted"/> --> <!-- Orion Style JNDI name -->
<!-- <jndi-jdbc jndi-server-name="localweblogic" jndi-name="PostgresDataSource"/> --> <!-- Weblogic Style JNDI name -->
@@ -388,7 +400,8 @@
jdbc-password="ofbiz"
isolation-level="ReadCommitted"
pool-minsize="2"
- pool-maxsize="250"/>
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/>
</datasource>
<datasource name="localoracle"
@@ -409,7 +422,8 @@
jdbc-username="ofbiz"
jdbc-password="ofbiz"
pool-minsize="2"
- pool-maxsize="250"/>
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/>
</datasource>
<datasource name="localoracledd"
helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
@@ -425,7 +439,8 @@
jdbc-username="ofbiz"
jdbc-password="ofbiz"
pool-minsize="2"
- pool-maxsize="250"/>
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/>
</datasource>
<datasource name="localsybase"
@@ -447,7 +462,8 @@
jdbc-password="ofbiz1"
isolation-level="ReadCommitted"
pool-minsize="2"
- pool-maxsize="250"/>
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/>
</datasource>
<datasource name="localsapdb"
@@ -469,7 +485,8 @@
jdbc-password="ofbiz"
isolation-level="ReadCommitted"
pool-minsize="2"
- pool-maxsize="250"/>
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/>
<!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/env/jdbc/xa/localsapdb" isolation-level="ReadCommitted"/> --> <!-- Orion Style JNDI name -->
<!-- <jndi-jdbc jndi-server-name="localweblogic" jndi-name="SapDBDataSource"/> --> <!-- Weblogic Style JNDI name -->
<!-- <jndi-jdbc jndi-server-name="default" jndi-name="jdbc/localsapdb" isolation-level="ReadCommitted"/> --> <!-- JRun4 Style JNDI name -->
@@ -495,7 +512,8 @@
jdbc-password="masterkey"
isolation-level="ReadCommitted"
pool-minsize="2"
- pool-maxsize="250"/>
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/>
<!-- Sample remote URI: jdbc-uri="jdbc:firebirdsql://localhost:3050//opt/interbase/data/ofbiz.gdb" -->
<!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/env/jdbc/xa/localfirebird" isolation-level="ReadCommitted"/> --> <!-- Orion Style JNDI name -->
<!-- <tyrex-dataSource dataSource-name="firebird" isolation-level="ReadCommitted"/> Ã -->
@@ -536,7 +554,8 @@
jdbc-password="ofbiz"
isolation-level="ReadCommitted"
pool-minsize="2"
- pool-maxsize="250"/>
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/>
<!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/env/jdbc/xa/localmssql" isolation-level="ReadCommitted"/> --> <!-- Orion Style JNDI name -->
</datasource>
@@ -558,7 +577,8 @@
jdbc-password="ofbiz"
isolation-level="ReadCommitted"
pool-minsize="2"
- pool-maxsize="250"/>
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/>
<!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/OracleDataSource" isolation-level="Serializable"/> -->
</datasource>
@@ -584,6 +604,7 @@
jdbc-password="adssys"
isolation-level="ReadCommitted"
pool-minsize="2"
- pool-maxsize="250"/>
+ pool-maxsize="250"
+ timeBetweenEvictionRunsMillis="600000"/>
</datasource>
</entity-config>
Modified: ofbiz/trunk/framework/entity/dtd/entity-config.xsd
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/dtd/entity-config.xsd?rev=817082&r1=817081&r2=817082&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/dtd/entity-config.xsd (original)
+++ ofbiz/trunk/framework/entity/dtd/entity-config.xsd Sun Sep 20 19:14:41 2009
@@ -425,6 +425,7 @@
</xs:attribute>
<xs:attribute type="xs:nonNegativeInteger" name="pool-maxsize" default="50"/>
<xs:attribute type="xs:nonNegativeInteger" name="pool-minsize" default="2"/>
+ <xs:attribute type="xs:nonNegativeInteger" name="timeBetweenEvictionRunsMillis" default="600000"/>
<xs:attribute type="xs:nonNegativeInteger" name="pool-sleeptime" default="300000"/>
<xs:attribute type="xs:nonNegativeInteger" name="pool-lifetime" default="600000"/>
<xs:attribute type="xs:nonNegativeInteger" name="pool-deadlock-maxwait" default="300000"/>
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java?rev=817082&r1=817081&r2=817082&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java Sun Sep 20 19:14:41 2009
@@ -67,28 +67,38 @@
String dbPass = jotmJdbcElement.getAttribute("jdbc-password");
// pool settings
- int maxSize, minSize;
+ int maxSize, minSize, timeBetweenEvictionRunsMillis;
try {
maxSize = Integer.parseInt(jotmJdbcElement.getAttribute("pool-maxsize"));
} catch (NumberFormatException nfe) {
Debug.logError("Problems with pool settings [pool-maxsize=" + jotmJdbcElement.getAttribute("pool-maxsize") + "]; the values MUST be numbers, using default of 20.", module);
maxSize = 20;
} catch (Exception e) {
- Debug.logError(e, "Problems with pool settings", module);
+ Debug.logError("Problems with pool settings [pool-maxsize], using default of 20.", module);
maxSize = 20;
}
try {
minSize = Integer.parseInt(jotmJdbcElement.getAttribute("pool-minsize"));
} catch (NumberFormatException nfe) {
- Debug.logError("Problems with pool settings [pool-minsize=" + jotmJdbcElement.getAttribute("pool-minsize") + "]; the values MUST be numbers, using default of 5.", module);
+ Debug.logError("Problems with pool settings [pool-minsize=" + jotmJdbcElement.getAttribute("pool-minsize") + "]; the values MUST be numbers, using default of 2.", module);
minSize = 2;
} catch (Exception e) {
- Debug.logError(e, "Problems with pool settings", module);
+ Debug.logError("Problems with pool settings [pool-minsize], using default of 2.", module);
minSize = 2;
}
int maxIdle = maxSize / 2;
maxIdle = maxIdle > minSize ? maxIdle : minSize;
+ try {
+ timeBetweenEvictionRunsMillis = Integer.parseInt(jotmJdbcElement.getAttribute("timeBetweenEvictionRunsMillis"));
+ } catch (NumberFormatException nfe) {
+ Debug.logError("Problems with pool settings [timeBetweenEvictionRunsMillis=" + jotmJdbcElement.getAttribute("timeBetweenEvictionRunsMillis") + "]; the values MUST be numbers, using default of 600000.", module);
+ timeBetweenEvictionRunsMillis = 600000;
+ } catch (Exception e) {
+ Debug.logError("Problems with pool settings [timeBetweenEvictionRunsMillis], using default of 600000.", module);
+ timeBetweenEvictionRunsMillis = 600000;
+ }
+
// load the driver
Driver jdbcDriver;
try {
@@ -111,7 +121,8 @@
// configure the pool settings
GenericObjectPool pool = new GenericObjectPool();
- pool.setTimeBetweenEvictionRunsMillis(600000);
+
+ pool.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
pool.setMaxActive(maxSize);
pool.setMaxIdle(maxIdle);
pool.setMinIdle(minSize);
Re: svn commit: r817082 - in /ofbiz/trunk/framework/entity: config/entityengine.xml dtd/entity-config.xsd src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
Posted by Jacques Le Roux <ja...@les7arts.com>.
Done at revision: 817194
No problems about adding also numTestsPerEvictionRun ?
I think this should help future potential issues since people will be aware of this parameters and may try them.
Jacques
From: "Jacopo Cappellato" <ja...@hotwaxmedia.com>
>I think that "time-between-eviction-runs-millis" would be a better choice.
>
> Jacopo
>
> On Sep 21, 2009, at 7:45 AM, Jacques Le Roux wrote:
>
>> Hi Jacopo,
>>
>> I picked the DBCP name for the parameter, what would you suggest ?
>>
>> Jacques
>>
>> From: "Jacopo Cappellato" <ja...@hotwaxmedia.com>
>>> Hi Jacques,
>>>
>>> the name of the parameter is not i the style of the other attributes used in entityengine.xml file.
>>> I think it is important to have a very strict naming convention, at least for central and important files like this one.
>>>
>>> Jacopo
>>>
>>> On Sep 20, 2009, at 10:49 PM, Jacques Le Roux wrote:
>>>
>>>> This is realted to Stale DB-connections
>>>>
>>>> I wondered if we should not make also numTestsPerEvictionRun an inline-jdbc parameter.
>>>> Maybe the case Hans Holmlund crossed was related with a too low value (default 3) in conjunction with 10 min for
>>>> timeBetweenEvictionRunsMillis
>>>>
>>>> Jacques
>>>>
>>>>> Author: jleroux
>>>>> Date: Sun Sep 20 19:14:41 2009
>>>>> New Revision: 817082
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=817082&view=rev
>>>>> Log:
>>>>> Allow to set timeBetweenEvictionRunsMillis for each DB type from entityengine.xml. Keep default value at 600000 (10 min)
>>>>>
>>>>> Modified:
>>>>> ofbiz/trunk/framework/entity/config/entityengine.xml
>>>>> ofbiz/trunk/framework/entity/dtd/entity-config.xsd
>>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ DBCPConnectionFactory.java
>>>>>
>>>>> Modified: ofbiz/trunk/framework/entity/config/entityengine.xml
>>>>> URL:
>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/config/entityengine.xml?rev=817082&r1=817081&r2=817082&view=diff
>>>>> = = = = = = = = = = = ===================================================================
>>>>> --- ofbiz/trunk/framework/entity/config/entityengine.xml (original)
>>>>> +++ ofbiz/trunk/framework/entity/config/entityengine.xml Sun Sep 20 19:14:41 2009
>>>>> @@ -143,7 +143,8 @@
>>>>> jdbc-password=""
>>>>> isolation-level="ReadUncommitted"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/>
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="java:/HsqlDataSource" isolation-level="ReadUncommitted"/> -->
>>>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/ env/jdbc/xa/localhsql"
>>>>> isolation-level="ReadUncommitted"/> -->
>>>>> <!-- Orion Style JNDI name -->
>>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="localhsqlDataSource"/> --> <!-- Weblogic Style JNDI name -->
>>>>> @@ -169,7 +170,8 @@
>>>>> jdbc-password="ofbiz"
>>>>> isolation-level="ReadCommitted"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/>
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
>>>>> </datasource>
>>>>> <datasource name="localderbyodbc"
>>>>> @@ -188,7 +190,8 @@
>>>>> jdbc-password="ofbiz"
>>>>> isolation-level="ReadCommitted"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/>
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
>>>>> </datasource>
>>>>> <datasource name="localderbyolap"
>>>>> @@ -211,7 +214,8 @@
>>>>> jdbc-password="ofbiz"
>>>>> isolation-level="ReadCommitted"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/>
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
>>>>> </datasource>
>>>>>
>>>>> @@ -231,7 +235,8 @@
>>>>> jdbc-password="ofbiz"
>>>>> isolation-level="ReadCommitted"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/>
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="java:/CloudscapeDataSource"
>>>>> solation-level="Serializable"/> -->
>>>>> </datasource>
>>>>>
>>>>> @@ -253,7 +258,8 @@
>>>>> jdbc-password="ofbiz"
>>>>> isolation-level="ReadCommitted"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/>
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="java:/DaffodilDataSource"
>>>>> solation-level="ReadCommitted"/> -->
>>>>> </datasource>
>>>>>
>>>>> @@ -274,7 +280,8 @@
>>>>> jdbc-password="ofbiz"
>>>>> isolation-level="ReadCommitted"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/>
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>>> </datasource>
>>>>>
>>>>> <datasource name="localmysql"
>>>>> @@ -301,7 +308,10 @@
>>>>> jdbc-password="ofbiz"
>>>>> isolation-level="ReadCommitted"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/>
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/><!-- Please note that at least one person has experienced a problem
>>>>> with
>>>>> this value with MySQL
>>>>> + and had to set it to -1 in order to avoid this issue.
>>>>> + For more look at http://markmail.org/thread/5sivpykv7xkl66px and
>>>>> http://commons.apache.org/dbcp/configuration.html-->
>>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
>>>>> </datasource>
>>>>> <datasource name="odbcmysql"
>>>>> @@ -325,7 +335,8 @@
>>>>> jdbc-password="ofbiz"
>>>>> isolation-level="ReadCommitted"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/>
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
>>>>> </datasource>
>>>>>
>>>>> @@ -353,9 +364,10 @@
>>>>> jdbc-password="ofbiz"
>>>>> isolation-level="ReadCommitted"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/><!-- Be warned that at this date (2009-06-09) the max_connections parameters in
>>>>> postgresql.conf
>>>>> - is set by default to 100 by the initdb process see
>>>>> http://www.postgresql.org/docs/8.3/static/runtime-config-connection.html#GUC-MAX-CONNECTIONS--
>>>>> >
>>>>> -
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/><!-- Be warned that at this date (2009-09-20) the max_connections
>>>>> parameters in postgresql.conf
>>>>> + is set by default to 100 by the initdb process see
>>>>> http://www.postgresql.org/docs/8.4/static/runtime-config-connection.html#GUC-MAX-CONNECTIONS--
>>>>> >
>>>>> +
>>>>> <!-- <jndi-jdbc jndi-server-name="default" jndi- name="java:comp/env/jdbc/localpostgres"
>>>>> isolation-level="ReadCommitted"/>-->
>>>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/ env/jdbc/xa/localpostgres"
>>>>> isolation-level="ReadCommitted"/> --> <!-- Orion Style JNDI name -->
>>>>> <!-- <jndi-jdbc jndi-server-name="localweblogic" jndi- name="PostgresDataSource"/> --> <!-- Weblogic Style JNDI
>>>>> name -->
>>>>> @@ -388,7 +400,8 @@
>>>>> jdbc-password="ofbiz"
>>>>> isolation-level="ReadCommitted"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/>
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>>> </datasource>
>>>>>
>>>>> <datasource name="localoracle"
>>>>> @@ -409,7 +422,8 @@
>>>>> jdbc-username="ofbiz"
>>>>> jdbc-password="ofbiz"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/>
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>>> </datasource>
>>>>> <datasource name="localoracledd"
>>>>> helper- class="org.ofbiz.entity.datasource.GenericHelperDAO"
>>>>> @@ -425,7 +439,8 @@
>>>>> jdbc-username="ofbiz"
>>>>> jdbc-password="ofbiz"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/>
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>>> </datasource>
>>>>>
>>>>> <datasource name="localsybase"
>>>>> @@ -447,7 +462,8 @@
>>>>> jdbc-password="ofbiz1"
>>>>> isolation-level="ReadCommitted"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/>
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>>> </datasource>
>>>>>
>>>>> <datasource name="localsapdb"
>>>>> @@ -469,7 +485,8 @@
>>>>> jdbc-password="ofbiz"
>>>>> isolation-level="ReadCommitted"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/>
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/ env/jdbc/xa/localsapdb"
>>>>> isolation-level="ReadCommitted"/> -->
>>>>> <!-- Orion Style JNDI name -->
>>>>> <!-- <jndi-jdbc jndi-server-name="localweblogic" jndi- name="SapDBDataSource"/> --> <!-- Weblogic Style JNDI name -->
>>>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="jdbc/ localsapdb" isolation-level="ReadCommitted"/> --> <!--
>>>>> JRun4
>>>>> Style JNDI name -->
>>>>> @@ -495,7 +512,8 @@
>>>>> jdbc-password="masterkey"
>>>>> isolation-level="ReadCommitted"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/>
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>>> <!-- Sample remote URI: jdbc-uri="jdbc:firebirdsql:// localhost:3050//opt/interbase/data/ofbiz.gdb" -->
>>>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/ env/jdbc/xa/localfirebird"
>>>>> isolation-level="ReadCommitted"/> --> <!-- Orion Style JNDI name -->
>>>>> <!-- <tyrex-dataSource dataSource-name="firebird" isolation- level="ReadCommitted"/> Ã, -->
>>>>> @@ -536,7 +554,8 @@
>>>>> jdbc-password="ofbiz"
>>>>> isolation-level="ReadCommitted"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/>
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/ env/jdbc/xa/localmssql"
>>>>> isolation-level="ReadCommitted"/> -->
>>>>> <!-- Orion Style JNDI name -->
>>>>> </datasource>
>>>>>
>>>>> @@ -558,7 +577,8 @@
>>>>> jdbc-password="ofbiz"
>>>>> isolation-level="ReadCommitted"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/>
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="java:/OracleDataSource" isolation-level="Serializable"/> -->
>>>>> </datasource>
>>>>>
>>>>> @@ -584,6 +604,7 @@
>>>>> jdbc-password="adssys"
>>>>> isolation-level="ReadCommitted"
>>>>> pool-minsize="2"
>>>>> - pool-maxsize="250"/>
>>>>> + pool-maxsize="250"
>>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>>> </datasource>
>>>>> </entity-config>
>>>>>
>>>>> Modified: ofbiz/trunk/framework/entity/dtd/entity-config.xsd
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/dtd/entity-config.xsd?rev=817082&r1=817081&r2=817082&view=diff
>>>>> = = = = = = = = = = = ===================================================================
>>>>> --- ofbiz/trunk/framework/entity/dtd/entity-config.xsd (original)
>>>>> +++ ofbiz/trunk/framework/entity/dtd/entity-config.xsd Sun Sep 20 19:14:41 2009
>>>>> @@ -425,6 +425,7 @@
>>>>> </xs:attribute>
>>>>> <xs:attribute type="xs:nonNegativeInteger" name="pool- maxsize" default="50"/>
>>>>> <xs:attribute type="xs:nonNegativeInteger" name="pool- minsize" default="2"/>
>>>>> + <xs:attribute type="xs:nonNegativeInteger" name="timeBetweenEvictionRunsMillis" default="600000"/>
>>>>> <xs:attribute type="xs:nonNegativeInteger" name="pool- sleeptime" default="300000"/>
>>>>> <xs:attribute type="xs:nonNegativeInteger" name="pool- lifetime" default="600000"/>
>>>>> <xs:attribute type="xs:nonNegativeInteger" name="pool- deadlock-maxwait" default="300000"/>
>>>>>
>>>>> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ connection/DBCPConnectionFactory.java
>>>>> URL:
>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java?rev=817082&r1=817081&r2=817082&view=diff
>>>>> = = = = = = = = = = = ===================================================================
>>>>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ DBCPConnectionFactory.java (original)
>>>>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ DBCPConnectionFactory.java Sun Sep 20 19:14:41 2009
>>>>> @@ -67,28 +67,38 @@
>>>>> String dbPass = jotmJdbcElement.getAttribute("jdbc- password");
>>>>>
>>>>> // pool settings
>>>>> - int maxSize, minSize;
>>>>> + int maxSize, minSize, timeBetweenEvictionRunsMillis;
>>>>> try {
>>>>> maxSize = Integer.parseInt(jotmJdbcElement.getAttribute("pool-maxsize"));
>>>>> } catch (NumberFormatException nfe) {
>>>>> Debug.logError("Problems with pool settings [pool- maxsize=" + jotmJdbcElement.getAttribute("pool-maxsize") +
>>>>> "];
>>>>> the values MUST be numbers, using default of 20.", module);
>>>>> maxSize = 20;
>>>>> } catch (Exception e) {
>>>>> - Debug.logError(e, "Problems with pool settings", module);
>>>>> + Debug.logError("Problems with pool settings [pool- maxsize], using default of 20.", module);
>>>>> maxSize = 20;
>>>>> }
>>>>> try {
>>>>> minSize = Integer.parseInt(jotmJdbcElement.getAttribute("pool-minsize"));
>>>>> } catch (NumberFormatException nfe) {
>>>>> - Debug.logError("Problems with pool settings [pool- minsize=" + jotmJdbcElement.getAttribute("pool-minsize")
>>>>> +
>>>>> "];
>>>>> the values MUST be numbers, using default of 5.", module);
>>>>> + Debug.logError("Problems with pool settings [pool- minsize=" + jotmJdbcElement.getAttribute("pool-minsize")
>>>>> +
>>>>> "];
>>>>> the values MUST be numbers, using default of 2.", module);
>>>>> minSize = 2;
>>>>> } catch (Exception e) {
>>>>> - Debug.logError(e, "Problems with pool settings", module);
>>>>> + Debug.logError("Problems with pool settings [pool- minsize], using default of 2.", module);
>>>>> minSize = 2;
>>>>> }
>>>>> int maxIdle = maxSize / 2;
>>>>> maxIdle = maxIdle > minSize ? maxIdle : minSize;
>>>>>
>>>>> + try {
>>>>> + timeBetweenEvictionRunsMillis = Integer .parseInt
>>>>> (jotmJdbcElement.getAttribute("timeBetweenEvictionRunsMillis"));
>>>>> + } catch (NumberFormatException nfe) {
>>>>> + Debug.logError("Problems with pool settings [timeBetweenEvictionRunsMillis=" +
>>>>> jotmJdbcElement.getAttribute("timeBetweenEvictionRunsMillis") + "]; the values MUST be numbers, using default of 600000.",
>>>>> module);
>>>>> + timeBetweenEvictionRunsMillis = 600000;
>>>>> + } catch (Exception e) {
>>>>> + Debug.logError("Problems with pool settings [timeBetweenEvictionRunsMillis], using default of 600000.",
>>>>> module);
>>>>> + timeBetweenEvictionRunsMillis = 600000;
>>>>> + }
>>>>> +
>>>>> // load the driver
>>>>> Driver jdbcDriver;
>>>>> try {
>>>>> @@ -111,7 +121,8 @@
>>>>>
>>>>> // configure the pool settings
>>>>> GenericObjectPool pool = new GenericObjectPool();
>>>>> - pool.setTimeBetweenEvictionRunsMillis(600000);
>>>>> +
>>>>> + pool .setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
>>>>> pool.setMaxActive(maxSize);
>>>>> pool.setMaxIdle(maxIdle);
>>>>> pool.setMinIdle(minSize);
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Re: svn commit: r817082 - in /ofbiz/trunk/framework/entity: config/entityengine.xml dtd/entity-config.xsd src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
Posted by Jacopo Cappellato <ja...@hotwaxmedia.com>.
I think that "time-between-eviction-runs-millis" would be a better
choice.
Jacopo
On Sep 21, 2009, at 7:45 AM, Jacques Le Roux wrote:
> Hi Jacopo,
>
> I picked the DBCP name for the parameter, what would you suggest ?
>
> Jacques
>
> From: "Jacopo Cappellato" <ja...@hotwaxmedia.com>
>> Hi Jacques,
>>
>> the name of the parameter is not i the style of the other
>> attributes used in entityengine.xml file.
>> I think it is important to have a very strict naming convention,
>> at least for central and important files like this one.
>>
>> Jacopo
>>
>> On Sep 20, 2009, at 10:49 PM, Jacques Le Roux wrote:
>>
>>> This is realted to Stale DB-connections
>>>
>>> I wondered if we should not make also numTestsPerEvictionRun an
>>> inline-jdbc parameter.
>>> Maybe the case Hans Holmlund crossed was related with a too low
>>> value (default 3) in conjunction with 10 min for
>>> timeBetweenEvictionRunsMillis
>>>
>>> Jacques
>>>
>>>> Author: jleroux
>>>> Date: Sun Sep 20 19:14:41 2009
>>>> New Revision: 817082
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=817082&view=rev
>>>> Log:
>>>> Allow to set timeBetweenEvictionRunsMillis for each DB type from
>>>> entityengine.xml. Keep default value at 600000 (10 min)
>>>>
>>>> Modified:
>>>> ofbiz/trunk/framework/entity/config/entityengine.xml
>>>> ofbiz/trunk/framework/entity/dtd/entity-config.xsd
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/
>>>> DBCPConnectionFactory.java
>>>>
>>>> Modified: ofbiz/trunk/framework/entity/config/entityengine.xml
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/config/entityengine.xml?rev=817082&r1=817081&r2=817082&view=diff
>>>> = = = = = = = = =
>>>> =
>>>> =
>>>> ===================================================================
>>>> --- ofbiz/trunk/framework/entity/config/entityengine.xml (original)
>>>> +++ ofbiz/trunk/framework/entity/config/entityengine.xml Sun Sep
>>>> 20 19:14:41 2009
>>>> @@ -143,7 +143,8 @@
>>>> jdbc-password=""
>>>> isolation-level="ReadUncommitted"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/>
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>>>> name="java:/HsqlDataSource" isolation-level="ReadUncommitted"/> -->
>>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/
>>>> env/jdbc/xa/localhsql"
>>>> isolation-level="ReadUncommitted"/> -->
>>>> <!-- Orion Style JNDI name -->
>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>>>> name="localhsqlDataSource"/> --> <!-- Weblogic Style JNDI name -->
>>>> @@ -169,7 +170,8 @@
>>>> jdbc-password="ofbiz"
>>>> isolation-level="ReadCommitted"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/>
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>>>> name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
>>>> </datasource>
>>>> <datasource name="localderbyodbc"
>>>> @@ -188,7 +190,8 @@
>>>> jdbc-password="ofbiz"
>>>> isolation-level="ReadCommitted"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/>
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>>>> name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
>>>> </datasource>
>>>> <datasource name="localderbyolap"
>>>> @@ -211,7 +214,8 @@
>>>> jdbc-password="ofbiz"
>>>> isolation-level="ReadCommitted"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/>
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>>>> name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
>>>> </datasource>
>>>>
>>>> @@ -231,7 +235,8 @@
>>>> jdbc-password="ofbiz"
>>>> isolation-level="ReadCommitted"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/>
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>>>> name="java:/CloudscapeDataSource"
>>>> solation-level="Serializable"/> -->
>>>> </datasource>
>>>>
>>>> @@ -253,7 +258,8 @@
>>>> jdbc-password="ofbiz"
>>>> isolation-level="ReadCommitted"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/>
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>>>> name="java:/DaffodilDataSource" isolation-level="ReadCommitted"/>
>>>> -->
>>>> </datasource>
>>>>
>>>> @@ -274,7 +280,8 @@
>>>> jdbc-password="ofbiz"
>>>> isolation-level="ReadCommitted"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/>
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>> </datasource>
>>>>
>>>> <datasource name="localmysql"
>>>> @@ -301,7 +308,10 @@
>>>> jdbc-password="ofbiz"
>>>> isolation-level="ReadCommitted"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/>
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/><!--
>>>> Please note that at least one person has experienced a problem
>>>> with
>>>> this value with MySQL
>>>> + and had to set it to -1 in order to avoid this
>>>> issue.
>>>> + For more look at http://markmail.org/thread/5sivpykv7xkl66px
>>>> and
>>>> http://commons.apache.org/dbcp/configuration.html-->
>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>>>> name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
>>>> </datasource>
>>>> <datasource name="odbcmysql"
>>>> @@ -325,7 +335,8 @@
>>>> jdbc-password="ofbiz"
>>>> isolation-level="ReadCommitted"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/>
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>>>> name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
>>>> </datasource>
>>>>
>>>> @@ -353,9 +364,10 @@
>>>> jdbc-password="ofbiz"
>>>> isolation-level="ReadCommitted"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/><!-- Be warned that at this
>>>> date (2009-06-09) the max_connections parameters in
>>>> postgresql.conf
>>>> - is set by default to 100 by the initdb process see
>>>> http://www.postgresql.org/docs/8.3/static/runtime-config-connection.html#GUC-MAX-CONNECTIONS--
>>>> >
>>>> -
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/><!-- Be
>>>> warned that at this date (2009-09-20) the max_connections
>>>> parameters in postgresql.conf
>>>> + is set by default to 100 by the initdb process see
>>>> http://www.postgresql.org/docs/8.4/static/runtime-config-connection.html#GUC-MAX-CONNECTIONS--
>>>> >
>>>> +
>>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-
>>>> name="java:comp/env/jdbc/localpostgres"
>>>> isolation-level="ReadCommitted"/>-->
>>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/
>>>> env/jdbc/xa/localpostgres"
>>>> isolation-level="ReadCommitted"/> --> <!-- Orion Style JNDI name
>>>> -->
>>>> <!-- <jndi-jdbc jndi-server-name="localweblogic" jndi-
>>>> name="PostgresDataSource"/> --> <!-- Weblogic Style JNDI name -->
>>>> @@ -388,7 +400,8 @@
>>>> jdbc-password="ofbiz"
>>>> isolation-level="ReadCommitted"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/>
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>> </datasource>
>>>>
>>>> <datasource name="localoracle"
>>>> @@ -409,7 +422,8 @@
>>>> jdbc-username="ofbiz"
>>>> jdbc-password="ofbiz"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/>
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>> </datasource>
>>>> <datasource name="localoracledd"
>>>> helper-
>>>> class="org.ofbiz.entity.datasource.GenericHelperDAO"
>>>> @@ -425,7 +439,8 @@
>>>> jdbc-username="ofbiz"
>>>> jdbc-password="ofbiz"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/>
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>> </datasource>
>>>>
>>>> <datasource name="localsybase"
>>>> @@ -447,7 +462,8 @@
>>>> jdbc-password="ofbiz1"
>>>> isolation-level="ReadCommitted"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/>
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>> </datasource>
>>>>
>>>> <datasource name="localsapdb"
>>>> @@ -469,7 +485,8 @@
>>>> jdbc-password="ofbiz"
>>>> isolation-level="ReadCommitted"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/>
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/
>>>> env/jdbc/xa/localsapdb" isolation-level="ReadCommitted"/> -->
>>>> <!-- Orion Style JNDI name -->
>>>> <!-- <jndi-jdbc jndi-server-name="localweblogic" jndi-
>>>> name="SapDBDataSource"/> --> <!-- Weblogic Style JNDI name -->
>>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="jdbc/
>>>> localsapdb" isolation-level="ReadCommitted"/> --> <!-- JRun4
>>>> Style JNDI name -->
>>>> @@ -495,7 +512,8 @@
>>>> jdbc-password="masterkey"
>>>> isolation-level="ReadCommitted"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/>
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>> <!-- Sample remote URI: jdbc-uri="jdbc:firebirdsql://
>>>> localhost:3050//opt/interbase/data/ofbiz.gdb" -->
>>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/
>>>> env/jdbc/xa/localfirebird"
>>>> isolation-level="ReadCommitted"/> --> <!-- Orion Style JNDI name
>>>> -->
>>>> <!-- <tyrex-dataSource dataSource-name="firebird"
>>>> isolation- level="ReadCommitted"/> Ã, -->
>>>> @@ -536,7 +554,8 @@
>>>> jdbc-password="ofbiz"
>>>> isolation-level="ReadCommitted"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/>
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/
>>>> env/jdbc/xa/localmssql" isolation-level="ReadCommitted"/> -->
>>>> <!-- Orion Style JNDI name -->
>>>> </datasource>
>>>>
>>>> @@ -558,7 +577,8 @@
>>>> jdbc-password="ofbiz"
>>>> isolation-level="ReadCommitted"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/>
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>>>> name="java:/OracleDataSource" isolation-level="Serializable"/> -->
>>>> </datasource>
>>>>
>>>> @@ -584,6 +604,7 @@
>>>> jdbc-password="adssys"
>>>> isolation-level="ReadCommitted"
>>>> pool-minsize="2"
>>>> - pool-maxsize="250"/>
>>>> + pool-maxsize="250"
>>>> + timeBetweenEvictionRunsMillis="600000"/>
>>>> </datasource>
>>>> </entity-config>
>>>>
>>>> Modified: ofbiz/trunk/framework/entity/dtd/entity-config.xsd
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/dtd/entity-config.xsd?rev=817082&r1=817081&r2=817082&view=diff
>>>> = = = = = = = = =
>>>> =
>>>> =
>>>> ===================================================================
>>>> --- ofbiz/trunk/framework/entity/dtd/entity-config.xsd (original)
>>>> +++ ofbiz/trunk/framework/entity/dtd/entity-config.xsd Sun Sep
>>>> 20 19:14:41 2009
>>>> @@ -425,6 +425,7 @@
>>>> </xs:attribute>
>>>> <xs:attribute type="xs:nonNegativeInteger" name="pool-
>>>> maxsize" default="50"/>
>>>> <xs:attribute type="xs:nonNegativeInteger" name="pool-
>>>> minsize" default="2"/>
>>>> + <xs:attribute type="xs:nonNegativeInteger"
>>>> name="timeBetweenEvictionRunsMillis" default="600000"/>
>>>> <xs:attribute type="xs:nonNegativeInteger" name="pool-
>>>> sleeptime" default="300000"/>
>>>> <xs:attribute type="xs:nonNegativeInteger" name="pool-
>>>> lifetime" default="600000"/>
>>>> <xs:attribute type="xs:nonNegativeInteger" name="pool-
>>>> deadlock-maxwait" default="300000"/>
>>>>
>>>> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/
>>>> connection/DBCPConnectionFactory.java
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java?rev=817082&r1=817081&r2=817082&view=diff
>>>> = = = = = = = = =
>>>> =
>>>> =
>>>> ===================================================================
>>>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/
>>>> DBCPConnectionFactory.java (original)
>>>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/
>>>> DBCPConnectionFactory.java Sun Sep 20 19:14:41 2009
>>>> @@ -67,28 +67,38 @@
>>>> String dbPass = jotmJdbcElement.getAttribute("jdbc-
>>>> password");
>>>>
>>>> // pool settings
>>>> - int maxSize, minSize;
>>>> + int maxSize, minSize, timeBetweenEvictionRunsMillis;
>>>> try {
>>>> maxSize =
>>>> Integer.parseInt(jotmJdbcElement.getAttribute("pool-maxsize"));
>>>> } catch (NumberFormatException nfe) {
>>>> Debug.logError("Problems with pool settings [pool-
>>>> maxsize=" + jotmJdbcElement.getAttribute("pool-maxsize") + "];
>>>> the values MUST be numbers, using default of 20.", module);
>>>> maxSize = 20;
>>>> } catch (Exception e) {
>>>> - Debug.logError(e, "Problems with pool
>>>> settings", module);
>>>> + Debug.logError("Problems with pool settings
>>>> [pool- maxsize], using default of 20.", module);
>>>> maxSize = 20;
>>>> }
>>>> try {
>>>> minSize =
>>>> Integer.parseInt(jotmJdbcElement.getAttribute("pool-minsize"));
>>>> } catch (NumberFormatException nfe) {
>>>> - Debug.logError("Problems with pool settings
>>>> [pool- minsize=" + jotmJdbcElement.getAttribute("pool-minsize") +
>>>> "];
>>>> the values MUST be numbers, using default of 5.", module);
>>>> + Debug.logError("Problems with pool settings
>>>> [pool- minsize=" + jotmJdbcElement.getAttribute("pool-minsize") +
>>>> "];
>>>> the values MUST be numbers, using default of 2.", module);
>>>> minSize = 2;
>>>> } catch (Exception e) {
>>>> - Debug.logError(e, "Problems with pool
>>>> settings", module);
>>>> + Debug.logError("Problems with pool settings
>>>> [pool- minsize], using default of 2.", module);
>>>> minSize = 2;
>>>> }
>>>> int maxIdle = maxSize / 2;
>>>> maxIdle = maxIdle > minSize ? maxIdle : minSize;
>>>>
>>>> + try {
>>>> + timeBetweenEvictionRunsMillis = Integer .parseInt
>>>> (jotmJdbcElement.getAttribute("timeBetweenEvictionRunsMillis"));
>>>> + } catch (NumberFormatException nfe) {
>>>> + Debug.logError("Problems with pool settings
>>>> [timeBetweenEvictionRunsMillis=" +
>>>> jotmJdbcElement.getAttribute("timeBetweenEvictionRunsMillis") +
>>>> "]; the values MUST be numbers, using default of 600000.",
>>>> module);
>>>> + timeBetweenEvictionRunsMillis = 600000;
>>>> + } catch (Exception e) {
>>>> + Debug.logError("Problems with pool settings
>>>> [timeBetweenEvictionRunsMillis], using default of 600000.",
>>>> module);
>>>> + timeBetweenEvictionRunsMillis = 600000;
>>>> + }
>>>> +
>>>> // load the driver
>>>> Driver jdbcDriver;
>>>> try {
>>>> @@ -111,7 +121,8 @@
>>>>
>>>> // configure the pool settings
>>>> GenericObjectPool pool = new GenericObjectPool();
>>>> - pool.setTimeBetweenEvictionRunsMillis(600000);
>>>> +
>>>> +
>>>> pool
>>>> .setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
>>>> pool.setMaxActive(maxSize);
>>>> pool.setMaxIdle(maxIdle);
>>>> pool.setMinIdle(minSize);
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Re: svn commit: r817082 - in /ofbiz/trunk/framework/entity: config/entityengine.xml dtd/entity-config.xsd src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
Posted by Jacques Le Roux <ja...@les7arts.com>.
Hi Jacopo,
I picked the DBCP name for the parameter, what would you suggest ?
Jacques
From: "Jacopo Cappellato" <ja...@hotwaxmedia.com>
> Hi Jacques,
>
> the name of the parameter is not i the style of the other attributes used in entityengine.xml file.
> I think it is important to have a very strict naming convention, at least for central and important files like this one.
>
> Jacopo
>
> On Sep 20, 2009, at 10:49 PM, Jacques Le Roux wrote:
>
>> This is realted to Stale DB-connections
>>
>> I wondered if we should not make also numTestsPerEvictionRun an inline-jdbc parameter.
>> Maybe the case Hans Holmlund crossed was related with a too low value (default 3) in conjunction with 10 min for
>> timeBetweenEvictionRunsMillis
>>
>> Jacques
>>
>>> Author: jleroux
>>> Date: Sun Sep 20 19:14:41 2009
>>> New Revision: 817082
>>>
>>> URL: http://svn.apache.org/viewvc?rev=817082&view=rev
>>> Log:
>>> Allow to set timeBetweenEvictionRunsMillis for each DB type from entityengine.xml. Keep default value at 600000 (10 min)
>>>
>>> Modified:
>>> ofbiz/trunk/framework/entity/config/entityengine.xml
>>> ofbiz/trunk/framework/entity/dtd/entity-config.xsd
>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ DBCPConnectionFactory.java
>>>
>>> Modified: ofbiz/trunk/framework/entity/config/entityengine.xml
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/config/entityengine.xml?rev=817082&r1=817081&r2=817082&view=diff
>>> = = = = = = = = = =====================================================================
>>> --- ofbiz/trunk/framework/entity/config/entityengine.xml (original)
>>> +++ ofbiz/trunk/framework/entity/config/entityengine.xml Sun Sep 20 19:14:41 2009
>>> @@ -143,7 +143,8 @@
>>> jdbc-password=""
>>> isolation-level="ReadUncommitted"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/>
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/>
>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="java:/HsqlDataSource" isolation-level="ReadUncommitted"/> -->
>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/ env/jdbc/xa/localhsql"
>>> isolation-level="ReadUncommitted"/> -->
>>> <!-- Orion Style JNDI name -->
>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="localhsqlDataSource"/> --> <!-- Weblogic Style JNDI name -->
>>> @@ -169,7 +170,8 @@
>>> jdbc-password="ofbiz"
>>> isolation-level="ReadCommitted"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/>
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/>
>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
>>> </datasource>
>>> <datasource name="localderbyodbc"
>>> @@ -188,7 +190,8 @@
>>> jdbc-password="ofbiz"
>>> isolation-level="ReadCommitted"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/>
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/>
>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
>>> </datasource>
>>> <datasource name="localderbyolap"
>>> @@ -211,7 +214,8 @@
>>> jdbc-password="ofbiz"
>>> isolation-level="ReadCommitted"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/>
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/>
>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
>>> </datasource>
>>>
>>> @@ -231,7 +235,8 @@
>>> jdbc-password="ofbiz"
>>> isolation-level="ReadCommitted"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/>
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/>
>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="java:/CloudscapeDataSource"
>>> solation-level="Serializable"/> -->
>>> </datasource>
>>>
>>> @@ -253,7 +258,8 @@
>>> jdbc-password="ofbiz"
>>> isolation-level="ReadCommitted"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/>
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/>
>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="java:/DaffodilDataSource" isolation-level="ReadCommitted"/> -->
>>> </datasource>
>>>
>>> @@ -274,7 +280,8 @@
>>> jdbc-password="ofbiz"
>>> isolation-level="ReadCommitted"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/>
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/>
>>> </datasource>
>>>
>>> <datasource name="localmysql"
>>> @@ -301,7 +308,10 @@
>>> jdbc-password="ofbiz"
>>> isolation-level="ReadCommitted"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/>
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/><!-- Please note that at least one person has experienced a problem
>>> with
>>> this value with MySQL
>>> + and had to set it to -1 in order to avoid this issue.
>>> + For more look at http://markmail.org/thread/5sivpykv7xkl66px and
>>> http://commons.apache.org/dbcp/configuration.html-->
>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
>>> </datasource>
>>> <datasource name="odbcmysql"
>>> @@ -325,7 +335,8 @@
>>> jdbc-password="ofbiz"
>>> isolation-level="ReadCommitted"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/>
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/>
>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
>>> </datasource>
>>>
>>> @@ -353,9 +364,10 @@
>>> jdbc-password="ofbiz"
>>> isolation-level="ReadCommitted"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/><!-- Be warned that at this date (2009-06-09) the max_connections parameters in
>>> postgresql.conf
>>> - is set by default to 100 by the initdb process see
>>> http://www.postgresql.org/docs/8.3/static/runtime-config-connection.html#GUC-MAX-CONNECTIONS--
>>> >
>>> -
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/><!-- Be warned that at this date (2009-09-20) the max_connections
>>> parameters in postgresql.conf
>>> + is set by default to 100 by the initdb process see
>>> http://www.postgresql.org/docs/8.4/static/runtime-config-connection.html#GUC-MAX-CONNECTIONS--
>>> >
>>> +
>>> <!-- <jndi-jdbc jndi-server-name="default" jndi- name="java:comp/env/jdbc/localpostgres"
>>> isolation-level="ReadCommitted"/>-->
>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/ env/jdbc/xa/localpostgres"
>>> isolation-level="ReadCommitted"/> --> <!-- Orion Style JNDI name -->
>>> <!-- <jndi-jdbc jndi-server-name="localweblogic" jndi- name="PostgresDataSource"/> --> <!-- Weblogic Style JNDI name -->
>>> @@ -388,7 +400,8 @@
>>> jdbc-password="ofbiz"
>>> isolation-level="ReadCommitted"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/>
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/>
>>> </datasource>
>>>
>>> <datasource name="localoracle"
>>> @@ -409,7 +422,8 @@
>>> jdbc-username="ofbiz"
>>> jdbc-password="ofbiz"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/>
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/>
>>> </datasource>
>>> <datasource name="localoracledd"
>>> helper- class="org.ofbiz.entity.datasource.GenericHelperDAO"
>>> @@ -425,7 +439,8 @@
>>> jdbc-username="ofbiz"
>>> jdbc-password="ofbiz"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/>
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/>
>>> </datasource>
>>>
>>> <datasource name="localsybase"
>>> @@ -447,7 +462,8 @@
>>> jdbc-password="ofbiz1"
>>> isolation-level="ReadCommitted"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/>
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/>
>>> </datasource>
>>>
>>> <datasource name="localsapdb"
>>> @@ -469,7 +485,8 @@
>>> jdbc-password="ofbiz"
>>> isolation-level="ReadCommitted"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/>
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/>
>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/ env/jdbc/xa/localsapdb" isolation-level="ReadCommitted"/> -->
>>> <!-- Orion Style JNDI name -->
>>> <!-- <jndi-jdbc jndi-server-name="localweblogic" jndi- name="SapDBDataSource"/> --> <!-- Weblogic Style JNDI name -->
>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="jdbc/ localsapdb" isolation-level="ReadCommitted"/> --> <!-- JRun4
>>> Style JNDI name -->
>>> @@ -495,7 +512,8 @@
>>> jdbc-password="masterkey"
>>> isolation-level="ReadCommitted"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/>
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/>
>>> <!-- Sample remote URI: jdbc-uri="jdbc:firebirdsql:// localhost:3050//opt/interbase/data/ofbiz.gdb" -->
>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/ env/jdbc/xa/localfirebird"
>>> isolation-level="ReadCommitted"/> --> <!-- Orion Style JNDI name -->
>>> <!-- <tyrex-dataSource dataSource-name="firebird" isolation- level="ReadCommitted"/> Ã, -->
>>> @@ -536,7 +554,8 @@
>>> jdbc-password="ofbiz"
>>> isolation-level="ReadCommitted"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/>
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/>
>>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/ env/jdbc/xa/localmssql" isolation-level="ReadCommitted"/> -->
>>> <!-- Orion Style JNDI name -->
>>> </datasource>
>>>
>>> @@ -558,7 +577,8 @@
>>> jdbc-password="ofbiz"
>>> isolation-level="ReadCommitted"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/>
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/>
>>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi- name="java:/OracleDataSource" isolation-level="Serializable"/> -->
>>> </datasource>
>>>
>>> @@ -584,6 +604,7 @@
>>> jdbc-password="adssys"
>>> isolation-level="ReadCommitted"
>>> pool-minsize="2"
>>> - pool-maxsize="250"/>
>>> + pool-maxsize="250"
>>> + timeBetweenEvictionRunsMillis="600000"/>
>>> </datasource>
>>> </entity-config>
>>>
>>> Modified: ofbiz/trunk/framework/entity/dtd/entity-config.xsd
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/dtd/entity-config.xsd?rev=817082&r1=817081&r2=817082&view=diff
>>> = = = = = = = = = =====================================================================
>>> --- ofbiz/trunk/framework/entity/dtd/entity-config.xsd (original)
>>> +++ ofbiz/trunk/framework/entity/dtd/entity-config.xsd Sun Sep 20 19:14:41 2009
>>> @@ -425,6 +425,7 @@
>>> </xs:attribute>
>>> <xs:attribute type="xs:nonNegativeInteger" name="pool- maxsize" default="50"/>
>>> <xs:attribute type="xs:nonNegativeInteger" name="pool- minsize" default="2"/>
>>> + <xs:attribute type="xs:nonNegativeInteger" name="timeBetweenEvictionRunsMillis" default="600000"/>
>>> <xs:attribute type="xs:nonNegativeInteger" name="pool- sleeptime" default="300000"/>
>>> <xs:attribute type="xs:nonNegativeInteger" name="pool- lifetime" default="600000"/>
>>> <xs:attribute type="xs:nonNegativeInteger" name="pool- deadlock-maxwait" default="300000"/>
>>>
>>> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ connection/DBCPConnectionFactory.java
>>> URL:
>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java?rev=817082&r1=817081&r2=817082&view=diff
>>> = = = = = = = = = =====================================================================
>>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ DBCPConnectionFactory.java (original)
>>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/ DBCPConnectionFactory.java Sun Sep 20 19:14:41 2009
>>> @@ -67,28 +67,38 @@
>>> String dbPass = jotmJdbcElement.getAttribute("jdbc- password");
>>>
>>> // pool settings
>>> - int maxSize, minSize;
>>> + int maxSize, minSize, timeBetweenEvictionRunsMillis;
>>> try {
>>> maxSize = Integer.parseInt(jotmJdbcElement.getAttribute("pool-maxsize"));
>>> } catch (NumberFormatException nfe) {
>>> Debug.logError("Problems with pool settings [pool- maxsize=" + jotmJdbcElement.getAttribute("pool-maxsize") + "];
>>> the values MUST be numbers, using default of 20.", module);
>>> maxSize = 20;
>>> } catch (Exception e) {
>>> - Debug.logError(e, "Problems with pool settings", module);
>>> + Debug.logError("Problems with pool settings [pool- maxsize], using default of 20.", module);
>>> maxSize = 20;
>>> }
>>> try {
>>> minSize = Integer.parseInt(jotmJdbcElement.getAttribute("pool-minsize"));
>>> } catch (NumberFormatException nfe) {
>>> - Debug.logError("Problems with pool settings [pool- minsize=" + jotmJdbcElement.getAttribute("pool-minsize") +
>>> "];
>>> the values MUST be numbers, using default of 5.", module);
>>> + Debug.logError("Problems with pool settings [pool- minsize=" + jotmJdbcElement.getAttribute("pool-minsize") +
>>> "];
>>> the values MUST be numbers, using default of 2.", module);
>>> minSize = 2;
>>> } catch (Exception e) {
>>> - Debug.logError(e, "Problems with pool settings", module);
>>> + Debug.logError("Problems with pool settings [pool- minsize], using default of 2.", module);
>>> minSize = 2;
>>> }
>>> int maxIdle = maxSize / 2;
>>> maxIdle = maxIdle > minSize ? maxIdle : minSize;
>>>
>>> + try {
>>> + timeBetweenEvictionRunsMillis = Integer .parseInt
>>> (jotmJdbcElement.getAttribute("timeBetweenEvictionRunsMillis"));
>>> + } catch (NumberFormatException nfe) {
>>> + Debug.logError("Problems with pool settings [timeBetweenEvictionRunsMillis=" +
>>> jotmJdbcElement.getAttribute("timeBetweenEvictionRunsMillis") + "]; the values MUST be numbers, using default of 600000.",
>>> module);
>>> + timeBetweenEvictionRunsMillis = 600000;
>>> + } catch (Exception e) {
>>> + Debug.logError("Problems with pool settings [timeBetweenEvictionRunsMillis], using default of 600000.",
>>> module);
>>> + timeBetweenEvictionRunsMillis = 600000;
>>> + }
>>> +
>>> // load the driver
>>> Driver jdbcDriver;
>>> try {
>>> @@ -111,7 +121,8 @@
>>>
>>> // configure the pool settings
>>> GenericObjectPool pool = new GenericObjectPool();
>>> - pool.setTimeBetweenEvictionRunsMillis(600000);
>>> +
>>> + pool.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
>>> pool.setMaxActive(maxSize);
>>> pool.setMaxIdle(maxIdle);
>>> pool.setMinIdle(minSize);
>>>
>>>
>>
>>
>
>
Re: svn commit: r817082 - in /ofbiz/trunk/framework/entity: config/entityengine.xml dtd/entity-config.xsd src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
Posted by Jacopo Cappellato <ja...@hotwaxmedia.com>.
Hi Jacques,
the name of the parameter is not i the style of the other attributes
used in entityengine.xml file.
I think it is important to have a very strict naming convention, at
least for central and important files like this one.
Jacopo
On Sep 20, 2009, at 10:49 PM, Jacques Le Roux wrote:
> This is realted to Stale DB-connections
>
> I wondered if we should not make also numTestsPerEvictionRun an
> inline-jdbc parameter.
> Maybe the case Hans Holmlund crossed was related with a too low
> value (default 3) in conjunction with 10 min for
> timeBetweenEvictionRunsMillis
>
> Jacques
>
>> Author: jleroux
>> Date: Sun Sep 20 19:14:41 2009
>> New Revision: 817082
>>
>> URL: http://svn.apache.org/viewvc?rev=817082&view=rev
>> Log:
>> Allow to set timeBetweenEvictionRunsMillis for each DB type from
>> entityengine.xml. Keep default value at 600000 (10 min)
>>
>> Modified:
>> ofbiz/trunk/framework/entity/config/entityengine.xml
>> ofbiz/trunk/framework/entity/dtd/entity-config.xsd
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/
>> DBCPConnectionFactory.java
>>
>> Modified: ofbiz/trunk/framework/entity/config/entityengine.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/config/entityengine.xml?rev=817082&r1=817081&r2=817082&view=diff
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- ofbiz/trunk/framework/entity/config/entityengine.xml (original)
>> +++ ofbiz/trunk/framework/entity/config/entityengine.xml Sun Sep 20
>> 19:14:41 2009
>> @@ -143,7 +143,8 @@
>> jdbc-password=""
>> isolation-level="ReadUncommitted"
>> pool-minsize="2"
>> - pool-maxsize="250"/>
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/>
>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>> name="java:/HsqlDataSource" isolation-level="ReadUncommitted"/> -->
>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/
>> env/jdbc/xa/localhsql" isolation-level="ReadUncommitted"/> -->
>> <!-- Orion Style JNDI name -->
>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>> name="localhsqlDataSource"/> --> <!-- Weblogic Style JNDI name -->
>> @@ -169,7 +170,8 @@
>> jdbc-password="ofbiz"
>> isolation-level="ReadCommitted"
>> pool-minsize="2"
>> - pool-maxsize="250"/>
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/>
>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>> name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
>> </datasource>
>> <datasource name="localderbyodbc"
>> @@ -188,7 +190,8 @@
>> jdbc-password="ofbiz"
>> isolation-level="ReadCommitted"
>> pool-minsize="2"
>> - pool-maxsize="250"/>
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/>
>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>> name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
>> </datasource>
>> <datasource name="localderbyolap"
>> @@ -211,7 +214,8 @@
>> jdbc-password="ofbiz"
>> isolation-level="ReadCommitted"
>> pool-minsize="2"
>> - pool-maxsize="250"/>
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/>
>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>> name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
>> </datasource>
>>
>> @@ -231,7 +235,8 @@
>> jdbc-password="ofbiz"
>> isolation-level="ReadCommitted"
>> pool-minsize="2"
>> - pool-maxsize="250"/>
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/>
>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>> name="java:/CloudscapeDataSource" isolation-level="Serializable"/>
>> -->
>> </datasource>
>>
>> @@ -253,7 +258,8 @@
>> jdbc-password="ofbiz"
>> isolation-level="ReadCommitted"
>> pool-minsize="2"
>> - pool-maxsize="250"/>
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/>
>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>> name="java:/DaffodilDataSource" isolation-level="ReadCommitted"/> -->
>> </datasource>
>>
>> @@ -274,7 +280,8 @@
>> jdbc-password="ofbiz"
>> isolation-level="ReadCommitted"
>> pool-minsize="2"
>> - pool-maxsize="250"/>
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/>
>> </datasource>
>>
>> <datasource name="localmysql"
>> @@ -301,7 +308,10 @@
>> jdbc-password="ofbiz"
>> isolation-level="ReadCommitted"
>> pool-minsize="2"
>> - pool-maxsize="250"/>
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/><!--
>> Please note that at least one person has experienced a problem with
>> this value with MySQL
>> + and had to set it to -1 in order to avoid this
>> issue.
>> + For more look at http://markmail.org/thread/5sivpykv7xkl66px
>> and
>> http://commons.apache.org/dbcp/configuration.html-->
>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>> name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
>> </datasource>
>> <datasource name="odbcmysql"
>> @@ -325,7 +335,8 @@
>> jdbc-password="ofbiz"
>> isolation-level="ReadCommitted"
>> pool-minsize="2"
>> - pool-maxsize="250"/>
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/>
>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>> name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
>> </datasource>
>>
>> @@ -353,9 +364,10 @@
>> jdbc-password="ofbiz"
>> isolation-level="ReadCommitted"
>> pool-minsize="2"
>> - pool-maxsize="250"/><!-- Be warned that at this
>> date (2009-06-09) the max_connections parameters in
>> postgresql.conf
>> - is set by default to 100 by the initdb process see
>> http://www.postgresql.org/docs/8.3/static/runtime-config-connection.html#GUC-MAX-CONNECTIONS--
>> >
>> -
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/><!-- Be
>> warned that at this date (2009-09-20) the max_connections
>> parameters in postgresql.conf
>> + is set by default to 100 by the initdb process see
>> http://www.postgresql.org/docs/8.4/static/runtime-config-connection.html#GUC-MAX-CONNECTIONS--
>> >
>> +
>> <!-- <jndi-jdbc jndi-server-name="default" jndi-
>> name="java:comp/env/jdbc/localpostgres"
>> isolation-level="ReadCommitted"/>-->
>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/
>> env/jdbc/xa/localpostgres"
>> isolation-level="ReadCommitted"/> --> <!-- Orion Style JNDI name -->
>> <!-- <jndi-jdbc jndi-server-name="localweblogic" jndi-
>> name="PostgresDataSource"/> --> <!-- Weblogic Style JNDI name -->
>> @@ -388,7 +400,8 @@
>> jdbc-password="ofbiz"
>> isolation-level="ReadCommitted"
>> pool-minsize="2"
>> - pool-maxsize="250"/>
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/>
>> </datasource>
>>
>> <datasource name="localoracle"
>> @@ -409,7 +422,8 @@
>> jdbc-username="ofbiz"
>> jdbc-password="ofbiz"
>> pool-minsize="2"
>> - pool-maxsize="250"/>
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/>
>> </datasource>
>> <datasource name="localoracledd"
>> helper-
>> class="org.ofbiz.entity.datasource.GenericHelperDAO"
>> @@ -425,7 +439,8 @@
>> jdbc-username="ofbiz"
>> jdbc-password="ofbiz"
>> pool-minsize="2"
>> - pool-maxsize="250"/>
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/>
>> </datasource>
>>
>> <datasource name="localsybase"
>> @@ -447,7 +462,8 @@
>> jdbc-password="ofbiz1"
>> isolation-level="ReadCommitted"
>> pool-minsize="2"
>> - pool-maxsize="250"/>
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/>
>> </datasource>
>>
>> <datasource name="localsapdb"
>> @@ -469,7 +485,8 @@
>> jdbc-password="ofbiz"
>> isolation-level="ReadCommitted"
>> pool-minsize="2"
>> - pool-maxsize="250"/>
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/>
>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/
>> env/jdbc/xa/localsapdb" isolation-level="ReadCommitted"/> -->
>> <!-- Orion Style JNDI name -->
>> <!-- <jndi-jdbc jndi-server-name="localweblogic" jndi-
>> name="SapDBDataSource"/> --> <!-- Weblogic Style JNDI name -->
>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="jdbc/
>> localsapdb" isolation-level="ReadCommitted"/> --> <!-- JRun4
>> Style JNDI name -->
>> @@ -495,7 +512,8 @@
>> jdbc-password="masterkey"
>> isolation-level="ReadCommitted"
>> pool-minsize="2"
>> - pool-maxsize="250"/>
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/>
>> <!-- Sample remote URI: jdbc-uri="jdbc:firebirdsql://
>> localhost:3050//opt/interbase/data/ofbiz.gdb" -->
>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/
>> env/jdbc/xa/localfirebird"
>> isolation-level="ReadCommitted"/> --> <!-- Orion Style JNDI name -->
>> <!-- <tyrex-dataSource dataSource-name="firebird" isolation-
>> level="ReadCommitted"/> Ã -->
>> @@ -536,7 +554,8 @@
>> jdbc-password="ofbiz"
>> isolation-level="ReadCommitted"
>> pool-minsize="2"
>> - pool-maxsize="250"/>
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/>
>> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/
>> env/jdbc/xa/localmssql" isolation-level="ReadCommitted"/> -->
>> <!-- Orion Style JNDI name -->
>> </datasource>
>>
>> @@ -558,7 +577,8 @@
>> jdbc-password="ofbiz"
>> isolation-level="ReadCommitted"
>> pool-minsize="2"
>> - pool-maxsize="250"/>
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/>
>> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-
>> name="java:/OracleDataSource" isolation-level="Serializable"/> -->
>> </datasource>
>>
>> @@ -584,6 +604,7 @@
>> jdbc-password="adssys"
>> isolation-level="ReadCommitted"
>> pool-minsize="2"
>> - pool-maxsize="250"/>
>> + pool-maxsize="250"
>> + timeBetweenEvictionRunsMillis="600000"/>
>> </datasource>
>> </entity-config>
>>
>> Modified: ofbiz/trunk/framework/entity/dtd/entity-config.xsd
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/dtd/entity-config.xsd?rev=817082&r1=817081&r2=817082&view=diff
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- ofbiz/trunk/framework/entity/dtd/entity-config.xsd (original)
>> +++ ofbiz/trunk/framework/entity/dtd/entity-config.xsd Sun Sep 20
>> 19:14:41 2009
>> @@ -425,6 +425,7 @@
>> </xs:attribute>
>> <xs:attribute type="xs:nonNegativeInteger" name="pool-
>> maxsize" default="50"/>
>> <xs:attribute type="xs:nonNegativeInteger" name="pool-
>> minsize" default="2"/>
>> + <xs:attribute type="xs:nonNegativeInteger"
>> name="timeBetweenEvictionRunsMillis" default="600000"/>
>> <xs:attribute type="xs:nonNegativeInteger" name="pool-
>> sleeptime" default="300000"/>
>> <xs:attribute type="xs:nonNegativeInteger" name="pool-
>> lifetime" default="600000"/>
>> <xs:attribute type="xs:nonNegativeInteger" name="pool-
>> deadlock-maxwait" default="300000"/>
>>
>> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/
>> connection/DBCPConnectionFactory.java
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java?rev=817082&r1=817081&r2=817082&view=diff
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/
>> DBCPConnectionFactory.java (original)
>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/
>> DBCPConnectionFactory.java Sun Sep 20 19:14:41 2009
>> @@ -67,28 +67,38 @@
>> String dbPass = jotmJdbcElement.getAttribute("jdbc-
>> password");
>>
>> // pool settings
>> - int maxSize, minSize;
>> + int maxSize, minSize, timeBetweenEvictionRunsMillis;
>> try {
>> maxSize =
>> Integer.parseInt(jotmJdbcElement.getAttribute("pool-maxsize"));
>> } catch (NumberFormatException nfe) {
>> Debug.logError("Problems with pool settings [pool-
>> maxsize=" + jotmJdbcElement.getAttribute("pool-maxsize") + "];
>> the values MUST be numbers, using default of 20.", module);
>> maxSize = 20;
>> } catch (Exception e) {
>> - Debug.logError(e, "Problems with pool settings",
>> module);
>> + Debug.logError("Problems with pool settings [pool-
>> maxsize], using default of 20.", module);
>> maxSize = 20;
>> }
>> try {
>> minSize =
>> Integer.parseInt(jotmJdbcElement.getAttribute("pool-minsize"));
>> } catch (NumberFormatException nfe) {
>> - Debug.logError("Problems with pool settings [pool-
>> minsize=" + jotmJdbcElement.getAttribute("pool-minsize") + "];
>> the values MUST be numbers, using default of 5.", module);
>> + Debug.logError("Problems with pool settings [pool-
>> minsize=" + jotmJdbcElement.getAttribute("pool-minsize") + "];
>> the values MUST be numbers, using default of 2.", module);
>> minSize = 2;
>> } catch (Exception e) {
>> - Debug.logError(e, "Problems with pool settings",
>> module);
>> + Debug.logError("Problems with pool settings [pool-
>> minsize], using default of 2.", module);
>> minSize = 2;
>> }
>> int maxIdle = maxSize / 2;
>> maxIdle = maxIdle > minSize ? maxIdle : minSize;
>>
>> + try {
>> + timeBetweenEvictionRunsMillis =
>> Integer
>> .parseInt
>> (jotmJdbcElement.getAttribute("timeBetweenEvictionRunsMillis"));
>> + } catch (NumberFormatException nfe) {
>> + Debug.logError("Problems with pool settings
>> [timeBetweenEvictionRunsMillis=" +
>> jotmJdbcElement.getAttribute("timeBetweenEvictionRunsMillis") + "];
>> the values MUST be numbers, using default of 600000.",
>> module);
>> + timeBetweenEvictionRunsMillis = 600000;
>> + } catch (Exception e) {
>> + Debug.logError("Problems with pool settings
>> [timeBetweenEvictionRunsMillis], using default of 600000.", module);
>> + timeBetweenEvictionRunsMillis = 600000;
>> + }
>> +
>> // load the driver
>> Driver jdbcDriver;
>> try {
>> @@ -111,7 +121,8 @@
>>
>> // configure the pool settings
>> GenericObjectPool pool = new GenericObjectPool();
>> - pool.setTimeBetweenEvictionRunsMillis(600000);
>> +
>> +
>> pool.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
>> pool.setMaxActive(maxSize);
>> pool.setMaxIdle(maxIdle);
>> pool.setMinIdle(minSize);
>>
>>
>
>
Re: svn commit: r817082 - in /ofbiz/trunk/framework/entity: config/entityengine.xml dtd/entity-config.xsd src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
Posted by Jacques Le Roux <ja...@les7arts.com>.
This is realted to Stale DB-connections
I wondered if we should not make also numTestsPerEvictionRun an inline-jdbc parameter.
Maybe the case Hans Holmlund crossed was related with a too low value (default 3) in conjunction with 10 min for
timeBetweenEvictionRunsMillis
Jacques
> Author: jleroux
> Date: Sun Sep 20 19:14:41 2009
> New Revision: 817082
>
> URL: http://svn.apache.org/viewvc?rev=817082&view=rev
> Log:
> Allow to set timeBetweenEvictionRunsMillis for each DB type from entityengine.xml. Keep default value at 600000 (10 min)
>
> Modified:
> ofbiz/trunk/framework/entity/config/entityengine.xml
> ofbiz/trunk/framework/entity/dtd/entity-config.xsd
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
>
> Modified: ofbiz/trunk/framework/entity/config/entityengine.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/config/entityengine.xml?rev=817082&r1=817081&r2=817082&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/entity/config/entityengine.xml (original)
> +++ ofbiz/trunk/framework/entity/config/entityengine.xml Sun Sep 20 19:14:41 2009
> @@ -143,7 +143,8 @@
> jdbc-password=""
> isolation-level="ReadUncommitted"
> pool-minsize="2"
> - pool-maxsize="250"/>
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/>
> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/HsqlDataSource" isolation-level="ReadUncommitted"/> -->
> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/env/jdbc/xa/localhsql" isolation-level="ReadUncommitted"/> -->
> <!-- Orion Style JNDI name -->
> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="localhsqlDataSource"/> --> <!-- Weblogic Style JNDI name -->
> @@ -169,7 +170,8 @@
> jdbc-password="ofbiz"
> isolation-level="ReadCommitted"
> pool-minsize="2"
> - pool-maxsize="250"/>
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/>
> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
> </datasource>
> <datasource name="localderbyodbc"
> @@ -188,7 +190,8 @@
> jdbc-password="ofbiz"
> isolation-level="ReadCommitted"
> pool-minsize="2"
> - pool-maxsize="250"/>
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/>
> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
> </datasource>
> <datasource name="localderbyolap"
> @@ -211,7 +214,8 @@
> jdbc-password="ofbiz"
> isolation-level="ReadCommitted"
> pool-minsize="2"
> - pool-maxsize="250"/>
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/>
> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
> </datasource>
>
> @@ -231,7 +235,8 @@
> jdbc-password="ofbiz"
> isolation-level="ReadCommitted"
> pool-minsize="2"
> - pool-maxsize="250"/>
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/>
> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/CloudscapeDataSource" isolation-level="Serializable"/> -->
> </datasource>
>
> @@ -253,7 +258,8 @@
> jdbc-password="ofbiz"
> isolation-level="ReadCommitted"
> pool-minsize="2"
> - pool-maxsize="250"/>
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/>
> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/DaffodilDataSource" isolation-level="ReadCommitted"/> -->
> </datasource>
>
> @@ -274,7 +280,8 @@
> jdbc-password="ofbiz"
> isolation-level="ReadCommitted"
> pool-minsize="2"
> - pool-maxsize="250"/>
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/>
> </datasource>
>
> <datasource name="localmysql"
> @@ -301,7 +308,10 @@
> jdbc-password="ofbiz"
> isolation-level="ReadCommitted"
> pool-minsize="2"
> - pool-maxsize="250"/>
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/><!-- Please note that at least one person has experienced a problem with
> this value with MySQL
> + and had to set it to -1 in order to avoid this issue.
> + For more look at http://markmail.org/thread/5sivpykv7xkl66px and
> http://commons.apache.org/dbcp/configuration.html-->
> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
> </datasource>
> <datasource name="odbcmysql"
> @@ -325,7 +335,8 @@
> jdbc-password="ofbiz"
> isolation-level="ReadCommitted"
> pool-minsize="2"
> - pool-maxsize="250"/>
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/>
> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
> </datasource>
>
> @@ -353,9 +364,10 @@
> jdbc-password="ofbiz"
> isolation-level="ReadCommitted"
> pool-minsize="2"
> - pool-maxsize="250"/><!-- Be warned that at this date (2009-06-09) the max_connections parameters in
> postgresql.conf
> - is set by default to 100 by the initdb process see
> http://www.postgresql.org/docs/8.3/static/runtime-config-connection.html#GUC-MAX-CONNECTIONS-->
> -
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/><!-- Be warned that at this date (2009-09-20) the max_connections
> parameters in postgresql.conf
> + is set by default to 100 by the initdb process see
> http://www.postgresql.org/docs/8.4/static/runtime-config-connection.html#GUC-MAX-CONNECTIONS-->
> +
> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="java:comp/env/jdbc/localpostgres"
> isolation-level="ReadCommitted"/>-->
> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/env/jdbc/xa/localpostgres"
> isolation-level="ReadCommitted"/> --> <!-- Orion Style JNDI name -->
> <!-- <jndi-jdbc jndi-server-name="localweblogic" jndi-name="PostgresDataSource"/> --> <!-- Weblogic Style JNDI name -->
> @@ -388,7 +400,8 @@
> jdbc-password="ofbiz"
> isolation-level="ReadCommitted"
> pool-minsize="2"
> - pool-maxsize="250"/>
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/>
> </datasource>
>
> <datasource name="localoracle"
> @@ -409,7 +422,8 @@
> jdbc-username="ofbiz"
> jdbc-password="ofbiz"
> pool-minsize="2"
> - pool-maxsize="250"/>
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/>
> </datasource>
> <datasource name="localoracledd"
> helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
> @@ -425,7 +439,8 @@
> jdbc-username="ofbiz"
> jdbc-password="ofbiz"
> pool-minsize="2"
> - pool-maxsize="250"/>
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/>
> </datasource>
>
> <datasource name="localsybase"
> @@ -447,7 +462,8 @@
> jdbc-password="ofbiz1"
> isolation-level="ReadCommitted"
> pool-minsize="2"
> - pool-maxsize="250"/>
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/>
> </datasource>
>
> <datasource name="localsapdb"
> @@ -469,7 +485,8 @@
> jdbc-password="ofbiz"
> isolation-level="ReadCommitted"
> pool-minsize="2"
> - pool-maxsize="250"/>
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/>
> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/env/jdbc/xa/localsapdb" isolation-level="ReadCommitted"/> -->
> <!-- Orion Style JNDI name -->
> <!-- <jndi-jdbc jndi-server-name="localweblogic" jndi-name="SapDBDataSource"/> --> <!-- Weblogic Style JNDI name -->
> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="jdbc/localsapdb" isolation-level="ReadCommitted"/> --> <!-- JRun4
> Style JNDI name -->
> @@ -495,7 +512,8 @@
> jdbc-password="masterkey"
> isolation-level="ReadCommitted"
> pool-minsize="2"
> - pool-maxsize="250"/>
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/>
> <!-- Sample remote URI: jdbc-uri="jdbc:firebirdsql://localhost:3050//opt/interbase/data/ofbiz.gdb" -->
> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/env/jdbc/xa/localfirebird"
> isolation-level="ReadCommitted"/> --> <!-- Orion Style JNDI name -->
> <!-- <tyrex-dataSource dataSource-name="firebird" isolation-level="ReadCommitted"/> Ã -->
> @@ -536,7 +554,8 @@
> jdbc-password="ofbiz"
> isolation-level="ReadCommitted"
> pool-minsize="2"
> - pool-maxsize="250"/>
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/>
> <!-- <jndi-jdbc jndi-server-name="default" jndi-name="comp/env/jdbc/xa/localmssql" isolation-level="ReadCommitted"/> -->
> <!-- Orion Style JNDI name -->
> </datasource>
>
> @@ -558,7 +577,8 @@
> jdbc-password="ofbiz"
> isolation-level="ReadCommitted"
> pool-minsize="2"
> - pool-maxsize="250"/>
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/>
> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/OracleDataSource" isolation-level="Serializable"/> -->
> </datasource>
>
> @@ -584,6 +604,7 @@
> jdbc-password="adssys"
> isolation-level="ReadCommitted"
> pool-minsize="2"
> - pool-maxsize="250"/>
> + pool-maxsize="250"
> + timeBetweenEvictionRunsMillis="600000"/>
> </datasource>
> </entity-config>
>
> Modified: ofbiz/trunk/framework/entity/dtd/entity-config.xsd
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/dtd/entity-config.xsd?rev=817082&r1=817081&r2=817082&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/entity/dtd/entity-config.xsd (original)
> +++ ofbiz/trunk/framework/entity/dtd/entity-config.xsd Sun Sep 20 19:14:41 2009
> @@ -425,6 +425,7 @@
> </xs:attribute>
> <xs:attribute type="xs:nonNegativeInteger" name="pool-maxsize" default="50"/>
> <xs:attribute type="xs:nonNegativeInteger" name="pool-minsize" default="2"/>
> + <xs:attribute type="xs:nonNegativeInteger" name="timeBetweenEvictionRunsMillis" default="600000"/>
> <xs:attribute type="xs:nonNegativeInteger" name="pool-sleeptime" default="300000"/>
> <xs:attribute type="xs:nonNegativeInteger" name="pool-lifetime" default="600000"/>
> <xs:attribute type="xs:nonNegativeInteger" name="pool-deadlock-maxwait" default="300000"/>
>
> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java?rev=817082&r1=817081&r2=817082&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java (original)
> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java Sun Sep 20 19:14:41 2009
> @@ -67,28 +67,38 @@
> String dbPass = jotmJdbcElement.getAttribute("jdbc-password");
>
> // pool settings
> - int maxSize, minSize;
> + int maxSize, minSize, timeBetweenEvictionRunsMillis;
> try {
> maxSize = Integer.parseInt(jotmJdbcElement.getAttribute("pool-maxsize"));
> } catch (NumberFormatException nfe) {
> Debug.logError("Problems with pool settings [pool-maxsize=" + jotmJdbcElement.getAttribute("pool-maxsize") + "];
> the values MUST be numbers, using default of 20.", module);
> maxSize = 20;
> } catch (Exception e) {
> - Debug.logError(e, "Problems with pool settings", module);
> + Debug.logError("Problems with pool settings [pool-maxsize], using default of 20.", module);
> maxSize = 20;
> }
> try {
> minSize = Integer.parseInt(jotmJdbcElement.getAttribute("pool-minsize"));
> } catch (NumberFormatException nfe) {
> - Debug.logError("Problems with pool settings [pool-minsize=" + jotmJdbcElement.getAttribute("pool-minsize") + "];
> the values MUST be numbers, using default of 5.", module);
> + Debug.logError("Problems with pool settings [pool-minsize=" + jotmJdbcElement.getAttribute("pool-minsize") + "];
> the values MUST be numbers, using default of 2.", module);
> minSize = 2;
> } catch (Exception e) {
> - Debug.logError(e, "Problems with pool settings", module);
> + Debug.logError("Problems with pool settings [pool-minsize], using default of 2.", module);
> minSize = 2;
> }
> int maxIdle = maxSize / 2;
> maxIdle = maxIdle > minSize ? maxIdle : minSize;
>
> + try {
> + timeBetweenEvictionRunsMillis = Integer.parseInt(jotmJdbcElement.getAttribute("timeBetweenEvictionRunsMillis"));
> + } catch (NumberFormatException nfe) {
> + Debug.logError("Problems with pool settings [timeBetweenEvictionRunsMillis=" +
> jotmJdbcElement.getAttribute("timeBetweenEvictionRunsMillis") + "]; the values MUST be numbers, using default of 600000.",
> module);
> + timeBetweenEvictionRunsMillis = 600000;
> + } catch (Exception e) {
> + Debug.logError("Problems with pool settings [timeBetweenEvictionRunsMillis], using default of 600000.", module);
> + timeBetweenEvictionRunsMillis = 600000;
> + }
> +
> // load the driver
> Driver jdbcDriver;
> try {
> @@ -111,7 +121,8 @@
>
> // configure the pool settings
> GenericObjectPool pool = new GenericObjectPool();
> - pool.setTimeBetweenEvictionRunsMillis(600000);
> +
> + pool.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
> pool.setMaxActive(maxSize);
> pool.setMaxIdle(maxIdle);
> pool.setMinIdle(minSize);
>
>