commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juozas Baliuka" <>
Subject Re: DBCP status?
Date Wed, 02 Jul 2003 05:15:03 GMT
> b) suggested workaround?
There are a lot of good ways, but you can try this:

1. implement connection wrapper this way :
     methods are delegated to pooled connection, but not "close", it throws
Exception.(trivial step)
2. remove all "close" application code (trivial step).

3. Implement resource manager. It can be "Filter", "Controler" or
"BaseAction" in web application, "BaseThread" in multithreaded application,
"main" method in single threaded aplication or some "Dispacher" for

"3." is a very trivial too:

public class ConnectionManager implements Filter {

    public void doFilter(ServletRequest request, ServletResponse response,
    FilterChain chain)
    throws IOException, ServletException {
        try {

            Connection c = datasource.getConnection();

            ManagetConnection managed = decorate(c);


            chain.doFilter(request, response);


You can store managed connection in request attribute, ThreadLocal or as
method parameter.
I use it in production ( ThreadLocal ) and this way is very good for me.
It takes a few minutes for refactoring some application and solve all
resource leak problems without workarounds in pools.

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
Version: 6.0.491 / Virus Database: 290 - Release Date: 2003.06.24

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

View raw message