tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: [OT] ConnectionPool question
Date Tue, 10 Nov 2009 20:40:16 GMT
Hash: SHA1


On 11/10/2009 9:18 AM, Josh Gooding wrote:
> the reason there are multiple recycleConnection methods is because if a RS
> is passed to the front presentation layer, I have to have a way to close it,
> I have to be able to get the statement and connection somehow, and I don't
> want that in my code.

I was assuming that you were going to use Elli's suggestion to use a
ThreadLocal to capture any allocated Connection objects, and just close
everything at the end of the request processing.

If you're going to do that, you can be lazy about it and just always
close everything.

>>>From everything that everyone here has said, to semi fix this right:
> 1 - Each method that calls the DB for a RS needs to get it's own connection
> and close the resources itself (keeping it in the same scope)

This is, of course, recommended technique.

> 2 - The CP wrapper that is here, CAN be used, but could end up causing more
> problems in the long run.

Well, yes and no. "Yes" in the sense that you shouldn't encourage the
kind of coding behavior that's been exhibited in the past: by writing
such a wrapper and clean-up code, you (might) encourage laziness and
make the problem worse rather than better. "No" in the sense that I
don't believe this solution is actually going to exacerbate the actual
problem itself.

Good luck,
- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message