cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johannes Textor <jc.tex...@gmx.de>
Subject Re: REPOST: Database connection "overload"
Date Wed, 04 Jun 2008 10:28:59 GMT
Derek Hohls schrieb:
> Johannes
>  
> This was my thought too.  I have numerous modules & functions that
> open (and should close!) connections.  On manual inspection they all
> seem to be OK, but possibly there is one somewhere which is not correct.
> Hence my need to try and prevent this; or have the system in some way
> report exactly when & where this is happening so I can fix the offending
> code.   Any ideas on how to do this?
>   
I am not aware of any method which would allow one to inspect the
current state of the pool. Perhaps the best way would be to log any
opening and closing of connections, including the name of the component
which uses them, and scan the log files for connections which are not
correctly closed. The problem is in the design itself (opening and
closing JDBC connections in several places scattered around the
application) which makes such applications a mess to debug (been through
it myself).

A common source for this problem is when error messages get thrown which
interrupt the execution of the flow script. Unless you use something
like the OpenSessionInViewFilter which gets rid of this kind of problem,
in the case of an unexpected error your connections normally remain
open. This means that after 10 error messages or so your pool is
exhausted and you're stuck.

If you are not the kind of Java guy to implement the Open Session in
View Concept (which should work with JDBC connections too, not just
Hibernate Sessions), I'd recommend you use the try - catch - finally
idiom in *every* flowscript function which uses a JDBC connection.

Regards,
Johannes


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message