Example usage for javax.transaction.xa XAException XA_RBDEADLOCK

List of usage examples for javax.transaction.xa XAException XA_RBDEADLOCK

Introduction

In this page you can find the example usage for javax.transaction.xa XAException XA_RBDEADLOCK.

Prototype

int XA_RBDEADLOCK

To view the source code for javax.transaction.xa XAException XA_RBDEADLOCK.

Click Source Link

Document

A deadlock was detected.

Usage

From source file:org.nuxeo.ecm.core.storage.sql.TestSQLBackend.java

protected static void rollback(Session session, Xid xid) throws XAException {
    XAResource xaresource = ((SessionImpl) session).getXAResource();
    boolean rollback = true;
    try {/*w  ww .ja v a  2  s. co  m*/
        xaresource.end(xid, XAResource.TMFAIL);
    } catch (XAException e) {
        if (e.errorCode == XAException.XA_RBROLLBACK // Derby
                || e.errorCode == XAException.XA_RBDEADLOCK // Derby
                || e.getMessage().startsWith("XA_RBDEADLOCK") // MySQL
        ) {
            rollback = false;
        } else {
            throw e;
        }
    }
    if (rollback) {
        xaresource.rollback(xid);
    }
}