On 3/21/18 12:15 PM, Shawn Heisey wrote:
> On 3/21/2018 1:31 AM, Mark Thomas wrote:
>>> and that we need to
>>> change the factory on our pool definitions.
>> I believe not.
> Tomcat's documentation seems to disagree with this point. It
> specifically says to use org.apache.tomcat.jdbc.pool.DataSourceFactory,
> and doesn't list any other valid choices.

You must be looking at documentation describing how to use the
alternative pool mentioned above (tomcat-jdbc).  The config you
posted is correct for DBCP.

> But we have
> org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory in our
> configuration.  I've found questions from people whose Tomcat
> installations didn't even contain that class, where the answers said to
> switch to the factory in the documentation.  Apparently deb-based
> packages of Tomcat do not contain the latter class.
>
> I found a historical document for 7.0.42 with Google and it also shows
> that the factory should be set to the DataSourceFactory, not the
> BasicDataSourceFactory that we have.
>
> I do see "removeAbandoned" in the property constants in the 7.0 source
> code for BasicDataSourceFactory  I had thought that it wasn't there,
> but I realized that I was looking at trunk code when I came to that
> conclusion, and that BasicDataSourceFactory is in a dbcp2 package in
> trunk.  
Don't look at DBCP 2 code for troubleshooting the code you are
running.  Either look at the repackaged sources inside the tomcat
source, or find the version in the tomcat build files and go to the
old DBCP / pool sources referenced there.

Of course, you *should* upgrade both TC and the DBCP it ships so you
*can* look at that (much better) code.  See below for one reason why.
> So I'm not sure what to think, but I can say that the abandoned
> connection handling does not appear to actually be working.  So either
> my configuration is wrong, or the factory that we are using is ignoring
> part of the config.

One thing that could be going on is that in the old 1.x DBCP, 
abandoned connection removal only happens when borrows are
attempted.  So if you check out a lot of connections, abandon them
and don't ask for more, they won't get closed as abandoned until you
borrow a new one.  In DBCP 2, the removeAbandoned property is split
into two different properties:  removeAbandonedOnBorrow (the old
behavior) and removeAbandonedOnMaintenance.  The second one makes
abandoned connection removal run on pool maintenance (so will not
have to wait until a borrow is attempted).

Phil
>
> Thanks,
> Shawn
>
> p.s. I sent an earlier draft of this message, but did so from the wrong
> email address.  If the moderators decide to allow that message through,
> then you may see an almost-duplicate of this message.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to