Hey guys,

First of all my bad to asking the question on main page here, I did not go
through the guidelines section.

Here is my query:


I want to retry MySql queries in cases of deadlock which will be removed if
I can simply retry. I use apache tomcat jdbc pool library for mysql
connection pooling and it has concept of JdbcInterceptor objects which can
be attached to existing Connection object. I wonder how to use these
interceptors to do a query retry. How can I know if query has thrown an
exception and I should retry? I am thinking of doing something like this
but I am confused in getting the right retry logic: public class
JdbQueryRetryInterceptor extends JdbcInterceptor { private final static
Logger logger = LoggerFactory .getLogger(JdbQueryRetryInterceptor.class);
@Override public void reset(ConnectionPool parent, PooledConnection con) {
} } And I have added this interceptor in the pool properties:
p.setJdbcInterceptors("com.test.mysql.JdbQueryRetryInterceptor");
-- 
with regards,
Richeek

Reply via email to