You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Victor Subick <vs...@moniker.com> on 2004/04/16 20:57:14 UTC
[commons-pool] Dynamic pooling configuration.
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>
Re: [commons-pool] Dynamic pooling configuration.
Posted by Craig McClanahan <cr...@apache.org>.
Victor Subick wrote:
>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.
>
>
>
I'm by no means an expert on all aspects of [pool], but won't setting
the "minIdle" property do what you want?
Craig McClanahan
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org