db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <knut.hat...@oracle.com>
Subject Re: Deadlock XID with no SQL?
Date Thu, 23 Sep 2010 19:03:49 GMT
David Van Couvering <david@vancouvering.com> writes:

> I suspected as much, but the "blank" XID threw me.
> I think I may have found the cause, but now I can't reproduce now
> that I've restarted the server.  But I'll put the change in, and also
> add the backup logic of retrying a deadlock. 
> Can I reliably catch and retry on any SQLException that is a
> SQLTransientException? 

That's the idea, at least. There's no guarantee that the retry will
succeed, but it shouldn't cause any harm. I usually do a rollback() on
the connection before I retry so that I know exactly how much work was
rolled back, since I'm not sure if all the SQLTransientExceptions have
the same severity level.

Here's a code example that makes two more attempts before it gives up if
a transaction fails with a transient error:

In case you need some inspiration... :)

Knut Anders

View raw message