[ 
https://issues.apache.org/jira/browse/POOL-325?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Phil Steitz updated POOL-325:
-----------------------------
    Fix Version/s: 3.0

> testOnReturn() available as asynchronous
> ----------------------------------------
>
>                 Key: POOL-325
>                 URL: https://issues.apache.org/jira/browse/POOL-325
>             Project: Commons Pool
>          Issue Type: New Feature
>    Affects Versions: 2.4
>            Reporter: Jason Hill
>            Priority: Minor
>              Labels: performance
>             Fix For: 3.0
>
>
> I am using Pool2 as part of DBCP2 framework and I immediately found minor 
> performance issues with using testOnBorrow/testOnCreate only because the 
> waiting request is dependent on validation step to complete before the 
> transaction can complete.
> I opted instead for testWhileIdle and testOnReturn to reduce impact on live 
> transactions. I assumed incorrectly that the testOnReturn would be 
> asynchronous to prevent the transaction from further waiting on validation 
> procedure. I cannot think of a case where testOnReturn is as or more valuable 
> than testOnBorrow unless it provided an asynchronous advantage. I am 
> interested to hear the intended value?
> Either way, I am proposing that testOnReturn provide asynchronous behavior by 
> default or allow a configurable flag to enable async behavior.
> https://git-wip-us.apache.org/repos/asf?p=commons-pool.git;a=blob;f=src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java;h=816c6cf54aad612805b9d48139a3f87b505c0bd8;hb=HEAD
> CURRENT:
>  548         if (getTestOnReturn()) {
>  549             if (!factory.validateObject(p)) {
>  550                 try {
>  551                     destroy(p);
>  552                 } catch (final Exception e) {
>  553                     swallowException(e);
>  554                 }
>  555                 try {
>  556                     ensureIdle(1, false);
>  557                 } catch (final Exception e) {
>  558                     swallowException(e);
>  559                 }
>  560                 updateStatsReturn(activeTime);
>  561                 return;
>  562             }
>  563         }



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to