I'm writing a red5 application that actually is on a tomcat server and uses the spring framework that connects to a mysql server (the fact that it's a red5 application shouldn't really matter, it's a java ee app.)
i use the spring framework to connect to my database.
I noticed that on some of the queries I get the following error message
Lock wait timeout exceeded; try restarting transaction
I already configured the lock timeout on my server to 10 seconds, so it's got to be something in my server. I would like to debug the mysql server whenever this happens. Maybe to run show processlist
and to get the output or to throw proper error messages.
Is there a way to connect a hook of some sort to the JdbcTemplate
that I'm using within the spring framework to handle all cases of lock timeout? Maybe to try to retry several times, to send messages and so on.
So the thing is that I do not want to check SQLException
in each place in my project and to handle it individually. This is a big project it would take a long time. Is there a way to configure that whenever an SQLException
is thrown? I'll be able to check which kind and to handle and to allow to retry, but to build something generic instead of inserting try catch and handle on each query?