Example usage for javax.transaction.xa XAException XAException

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

Introduction

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

Prototype

public XAException(int errcode) 

Source Link

Document

Create an XAException with a given error code.

Usage

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

protected void commitDone() throws XAException {
    inTransaction = false;//from w w w .  j av a 2 s  .  com
    try {
        try {
            sendInvalidationsToOthers();
        } finally {
            checkThreadEnd();
        }
    } catch (Exception e) {
        log.error("Could not send invalidations", e);
        throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e);
    }
}

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

public void start(Xid xid, int flags) throws XAException {
    if (flags == TMNOFLAGS) {
        try {// w ww. ja v a  2s.  c om
            session.processReceivedInvalidations();
        } catch (Exception e) {
            log.error("Could not start transaction", e);
            throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e);
        }
    }
    mapper.start(xid, flags);
    inTransaction = true;
    session.checkThreadStart();
}

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

public void end(Xid xid, int flags) throws XAException {
    boolean failed = true;
    try {/* w  w  w.  j a v a2 s. c  o  m*/
        if (flags != TMFAIL) {
            try {
                session.flush();
            } catch (Exception e) {
                log.error("Could not end transaction", e);
                throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e);
            }
        }
        failed = false;
        mapper.end(xid, flags);
    } finally {
        if (failed) {
            try {
                mapper.end(xid, TMFAIL);
            } finally {
                rollback(xid);
            }
        }
    }
}

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

public void commit(Xid xid, boolean onePhase) throws XAException {
    try {/*  w w  w . j  av  a 2 s . c  om*/
        mapper.commit(xid, onePhase);
    } finally {
        inTransaction = false;
        try {
            try {
                session.sendInvalidationsToOthers();
            } finally {
                session.checkThreadEnd();
            }
        } catch (Exception e) {
            log.error("Could not commit transaction", e);
            throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e);
        }
    }
}

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

public void rollback(Xid xid) throws XAException {
    try {/*from   w ww  . j a  v  a 2 s.  c  o m*/
        try {
            mapper.rollback(xid);
        } finally {
            session.rollback();
        }
    } finally {
        inTransaction = false;
        try {
            try {
                session.sendInvalidationsToOthers();
            } finally {
                session.checkThreadEnd();
            }
        } catch (Exception e) {
            log.error("Could not rollback transaction", e);
            throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e);
        }
    }
}

From source file:org.wso2.andes.client.XASession_9_1.java

/**
 * Throw {@link XAException} if the connection is closed
 *
 * @throws XAException if connection not active
 *//*from   w  w w  .  j a  v a2 s  . com*/
private void throwErrorIfClosed() throws XAException {
    if (isClosed()) {
        XAException xaException = new XAException("Session is already closed");
        xaException.errorCode = XAException.XA_RBCOMMFAIL;
        throw xaException;
    }
}