commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zoly farkas <zolyfar...@yahoo.com>
Subject Re: [pool] potential new method for interface ObjectPool<T>
Date Wed, 02 Feb 2011 20:28:53 GMT
Done:

https://issues.apache.org/jira/browse/POOL-183




----- Original Message ----
From: Phil Steitz <phil.steitz@gmail.com>
To: Commons Developers List <dev@commons.apache.org>
Sent: Wed, February 2, 2011 2:18:52 PM
Subject: Re: [pool] potential new method for interface ObjectPool<T>

On 2/2/11 1:46 PM, zoly farkas wrote:
> Would it be possible to add a method:
>
> void returnAndValidateObject(T obj) throws Exception
>
> In general I was thinking of the following use case:
>
> Object o = pool.borrowObject();
> try
> {
>    .........
>    o.doStuff();
>    .........
>    pool.returnObject(o);
> }
> catch(Exception e)
> {
>    // not sure what the cause is, let's make sure o is valid.
>    pool.returnAndValidateObject(o);
> }
>
> the reason is that validation in general is an expensive operation, and 
>enabling 
>
> it all the time is inpractical.
>
> any thoughts ?

Sounds like an interesting feature request, at least worth talking
about.  Can you open a JIRA so we don't forget it?  If you hold a
reference to the PoolableObjectFactory associated with the pool, you
can explicitly call the factory's validate method prior to returning
an instance to enable this behavior with the current implementation.

Phil
> --Zoltan
>
>
>      
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


      

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message