commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Raeburn" <st...@ninsky.com>
Subject RE: DBCP status?
Date Mon, 30 Jun 2003 01:36:18 GMT
My $0.02 is that the cure (reclaiming connections) is worse that the disease
(leaking connections through programmer error).

Better intermittent problems due to faulty code (which though hard to find
is possible to correct) than  intermittent problems when your code is 100%
correct. How hard would *that* be to fix!?

Steve

> -----Original Message-----
> From: Tim Funk [mailto:funkman@joedog.org]
> Sent: June 29, 2003 6:18 PM
> To: Jakarta Commons Developers List
> Subject: Re: DBCP status?
>
>
> David Graham wrote:
> > I am open to designing DBCP in such a way that allows people to
> plugin the
> > behaviors they need including reclaming connections (the
> Strategy pattern
> > may be useful here).  However, DBCP should never provide that
> > functionality out of the box because it implies that Jakarta
> supports poor
> > programming practices.
> >
>
> +1 for allowing people to plugin their own "kludge" to reclaim
> connections.
> In a perfect world we (ok, me) wouldn't need the reclaiming
> connection code.
> But I still (in fact 3 weeks ago) fall victim to the following
> cut and paste
> typos, for example:
>
> Connection con;
> PreparedStatement ps;
> ResultSet rs;
> try {
>     con = magicGetConnection();
>     //stuff
> } catch(...) {
> } finally {
>    try {if (rs!=null){ rs.close(); rs=null; } } catch(Throwable ignore){}
>    try {if (ps!=null){ ps.close(); ps=null; } } catch(Throwable ignore){}
>    try {if (ps!=null){ con.close(); con=null; } } catch(Throwable
> ignore){}
> }
>
> In the above code - I try to use the good practice of
> try-catch-finally. My
> code works great in the testing environment (of course it should fail in
> stress testing in cases it can be done). The peer review goes
> great (or gets
> ommitted for some places which don't have that luxury) and the
> peer reviewer
> also overlooks the leaking connection. Time for production -
> within hours -
> the site starts acting strange but only intermittently. The
> reclamation of
> connections keeps the site running and the logging we get allows
> us to say "O
> crap!" and fix the problem quickly.
>
> Some of try to use great programming practices but we are mere
> mortals. I am
> not in favor of haphazardly  yanking connections. But in some
> environments,
> yanking the connection away from the application may not be that bad of a
> thing.
>
>
> -Tim
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message