commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Hill (JIRA)" <>
Subject [jira] [Created] (POOL-325) testOnReturn() available as asynchronous
Date Mon, 01 May 2017 01:48:04 GMT
Jason Hill created POOL-325:

             Summary: testOnReturn() available as asynchronous
                 Key: POOL-325
             Project: Commons Pool
          Issue Type: New Feature
    Affects Versions: 2.4
            Reporter: Jason Hill
            Priority: Minor

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 testOnBorrow provide asynchronous behavior by default or allow
a configurable flag to enable async behavior.;a=blob;f=src/main/java/org/apache/commons/pool2/impl/;h=816c6cf54aad612805b9d48139a3f87b505c0bd8;hb=HEAD
 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

View raw message