dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20388
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9281: Impl support for defining max connection pool size in hibernate.properties - hibernate.c3p0.max_size
------------------------------------------------------------
revno: 9281
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-12-12 13:28:49 +0100
message:
Impl support for defining max connection pool size in hibernate.properties - hibernate.c3p0.max_size
modified:
dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/ConnectionPropertyFactoryBean.java
dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/META-INF/dhis/beans.xml
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/ConnectionPropertyFactoryBean.java'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/ConnectionPropertyFactoryBean.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/ConnectionPropertyFactoryBean.java 2012-12-12 12:28:49 +0000
@@ -27,6 +27,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
import org.springframework.beans.factory.FactoryBean;
/**
@@ -53,6 +55,13 @@
{
this.hibernateProperty = hibernateProperty;
}
+
+ private String defaultValue;
+
+ public void setDefaultValue( String defaultValue )
+ {
+ this.defaultValue = defaultValue;
+ }
// -------------------------------------------------------------------------
// FactoryBean implementation
@@ -61,7 +70,9 @@
public String getObject()
throws Exception
{
- return hibernateConfigurationProvider.getConfiguration().getProperty( hibernateProperty );
+ String value = hibernateConfigurationProvider.getConfiguration().getProperty( hibernateProperty );
+
+ return StringUtils.defaultIfEmpty( value, defaultValue );
}
public Class<String> getObjectType()
=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/META-INF/dhis/beans.xml 2012-03-31 15:08:23 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/META-INF/dhis/beans.xml 2012-12-12 12:28:49 +0000
@@ -55,8 +55,8 @@
<property name="jdbcUrl" ref="url" />
<property name="user" ref="username" />
<property name="password" ref="password" />
+ <property name="maxPoolSize" ref="maxPoolSize" />
<property name="acquireIncrement" value="6" />
- <property name="maxPoolSize" value="40" />
<property name="maxIdleTime" value="7200" />
</bean>
@@ -84,5 +84,11 @@
<property name="hibernateConfigurationProvider" ref="hibernateConfigurationProvider" />
<property name="hibernateProperty" value="hibernate.connection.password" />
</bean>
-
+
+ <bean id="maxPoolSize" class="org.hisp.dhis.hibernate.ConnectionPropertyFactoryBean">
+ <property name="hibernateConfigurationProvider" ref="hibernateConfigurationProvider" />
+ <property name="hibernateProperty" value="hibernate.c3p0.max_size" />
+ <property name="defaultValue" value="40" />
+ </bean>
+
</beans>