commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Victor Subick" <vsub...@moniker.com>
Subject [commons-pool] Dynamic pooling configuration.
Date Fri, 16 Apr 2004 18:57:14 GMT
Hello, I have used this pooling package in the past and it is wonderful.
Thanks again (Jakarta) for a wonderful product. I love you guys and gals. 

 

I have a question. How can I change the behavior of the pooling package to
load all my poolable objects initially instead of on demand. Say that I
define 10 maxActives but I want to instantiate all 10 at runtime and keep
them idle forever regardless of use.  I wish this to be dynamic. So that I
can specify this behavior at runtime (via a properties file) whether it is
on demand (default behavior) or all at startup.

 

 

This behavior should be similar to how Jakarta Struts allows the ability to
change Poolable characteristics 

 

<object class="org.apache.commons.dbcp.PoolableConnectionFactory"
xmlns="http://apache.org/xml/xmlns/jakarta/commons/jocl">
   <!-- the first argument is the ConnectionFactory -->
   <object class="org.apache.commons.dbcp.DriverManagerConnectionFactory">
      <string value="jdbc:some:connect:string"/>
      <object class="java.util.Properties" null="true"/>
   </object>
   <!-- the next argument is the ObjectPool -->
   <object class="org.apache.commons.pool.impl.GenericObjectPool">
      <object class="org.apache.commons.pool.PoolableObjectFactory"
null="true"/>
      <int value="10"/> <!-- max active -->
      <byte value="1"/> <!-- when exhausted action, 0 = fail, 1 = block, 2 =
grow -->
      <long value="2000"/> <!-- max wait -->
      <int value="10"/> <!-- max idle -->
      <boolean value="false"/> <!-- test on borrow -->
      <boolean value="false"/> <!-- test on return -->
      <long value="10000"/> <!-- time between eviction runs -->
      <int value="5"/> <!-- number of connections to test per eviction run
-->
      <long value="5000"/> <!-- min evictable idle time -->
      <boolean value="true"/> <!-- test while idle -->
   </object>
   <!-- the next argument is the KeyedObjectPoolFactory -->
   <object class="org.apache.commons.pool.StackKeyedObjectPoolFactory">
      <int value="5"/> <!-- max idle -->
   </object>
   <string value="SELECT COUNT(*) FROM DUAL"/> <;!-- validation query -->
   <boolean value="false"/> <!-- default read only -->
   <boolean value="true"/> <!-- default auto commit -->

</object>

 

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message