Example usage for javax.transaction.xa XAException initCause

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

Introduction

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

Prototype

public synchronized Throwable initCause(Throwable cause) 

Source Link

Document

Initializes the cause of this throwable to the specified value.

Usage

From source file:org.nuxeo.ecm.core.blob.storage.impl.XASession.java

public int prepare(Xid xid) throws XAException {
    TransactionContext tx = (TransactionContext) transactions.get(xid);
    if (tx == null) {
        throw new XAException(XAException.XAER_NOTA);
    }/*from  ww w .  ja v a 2s . com*/
    try {
        tx.prepare();
    } catch (ResourceException e) {
        XAException ee = new XAException(XAException.XAER_RMERR);
        ee.initCause(e);
        throw ee;
    }
    return XA_OK;
}

From source file:org.nuxeo.ecm.core.blob.storage.impl.XASession.java

public void rollback(Xid xid) throws XAException {
    TransactionContext tx = (TransactionContext) transactions.get(xid);
    if (tx == null) {
        throw new XAException(XAException.XAER_NOTA);
    }/*from  w  w  w .  j  a v a 2 s  . c  om*/
    try {
        tx.rollback();
    } catch (ResourceException e) {
        XAException ee = new XAException(XAException.XAER_RMERR);
        ee.initCause(e);
        throw ee;
    }
    transactions.remove(xid);
}