Example usage for javax.transaction.xa XAException XAER_NOTA

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

Introduction

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

Prototype

int XAER_NOTA

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

Click Source Link

Document

The XID is not valid.

Usage

From source file:org.mule.util.xa.DefaultXASession.java

public void forget(Xid xid) throws XAException {
    if (logger.isDebugEnabled()) {
        logger.debug("Forgetting transaction branch " + xid);
    }/*from w  w w . ja va  2 s  . co  m*/
    AbstractTransactionContext context = resourceManager.getTransactionalResource(xid);
    if (context == null) {
        throw new XAException(XAException.XAER_NOTA);
    }
    resourceManager.removeActiveTransactionalResource(xid);
    resourceManager.removeSuspendedTransactionalResource(xid);
}

From source file:org.mule.util.xa.XaTransactionRecoverer.java

public void rollbackDandlingTransaction(Xid xid) throws XAException {
    try {/*w w  w.  jav a 2 s  . c  o  m*/
        logger.info("Rollbacking danling tx with id " + xid);
        new PersistentXaTransactionContext(xaTxQueueTransactionJournal, queueProvider, xid).doRollback();
    } catch (ResourceManagerException e) {
        logger.warn(e.getMessage());
        if (logger.isDebugEnabled()) {
            logger.debug(e);
        }
        throw new XAException(XAException.XAER_NOTA);
    }
}

From source file:org.mule.util.xa.XaTransactionRecoverer.java

public void commitDandlingTransaction(Xid xid, boolean onePhase) throws XAException {
    try {//w ww  .  j  a  v  a 2  s. co m
        logger.info("Commiting danling tx with id " + xid);
        new PersistentXaTransactionContext(xaTxQueueTransactionJournal, queueProvider, xid).doCommit();
    } catch (ResourceManagerException e) {
        logger.warn(e.getMessage());
        if (logger.isDebugEnabled()) {
            logger.debug(e);
        }
        throw new XAException(XAException.XAER_NOTA);
    }
}

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

public void start(Xid xid, int flags) throws XAException {
    if (isAssociated()) {
        log.error("Resource already associated with a transaction.");
        throw new XAException(XAException.XAER_PROTO);
    }//from   w w w.  j  av  a  2s  .c o  m
    TransactionContext tx = (TransactionContext) transactions.get(xid);
    if (flags == TMNOFLAGS) {
        if (tx != null) {
            throw new XAException(XAException.XAER_DUPID);
        }
        tx = createTransaction(xid);
    } else if (flags == TMJOIN) {
        if (tx == null) {
            throw new XAException(XAException.XAER_NOTA);
        }
    } else if (flags == TMRESUME) {
        if (tx == null) {
            throw new XAException(XAException.XAER_NOTA);
        }
        if (!tx.isSuspended()) {
            log.error("Unable to resume: transaction not suspended.");
            throw new XAException(XAException.XAER_PROTO);
        }
        tx.setSuspended(false);
    } else {
        throw new XAException(XAException.XAER_INVAL);
    }

    associate(tx);
}

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

public void end(Xid xid, int flags) throws XAException {
    TransactionContext tx = (TransactionContext) transactions.get(xid);
    if (tx == null) {
        throw new XAException(XAException.XAER_NOTA);
    }//from   w ww .  j  a  v a2  s  .c  om
    if (flags == TMSUSPEND) {
        if (!isAssociated()) {
            log.error("Resource not associated with a transaction.");
            throw new XAException(XAException.XAER_PROTO);
        }
        associate(null);
        tx.setSuspended(true);
    } else if (flags == TMFAIL || flags == TMSUCCESS) {
        if (!tx.isSuspended()) {
            if (!isAssociated()) {
                log.error("Resource not associated with a transaction.");
                throw new XAException(XAException.XAER_PROTO);
            }
            associate(null);
        } else {
            tx.setSuspended(false);
        }
    } else {
        throw new XAException(XAException.XAER_INVAL);
    }
}

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

public void commit(Xid xid, boolean onePhase) throws XAException {
    TransactionContext tx = (TransactionContext) transactions.get(xid);
    if (tx == null) {
        throw new XAException(XAException.XAER_NOTA);
    }/*  w ww .  ja  v a  2 s  .  c o  m*/
    try {
        if (onePhase) {
            tx.prepare();
        }
        tx.commit();
    } catch (ResourceException e) {
        XAException ee = new XAException(XAException.XAER_RMERR);
        ee.initCause(e);
        throw ee;
    }

    transactions.remove(xid);
}

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);
    }/* ww  w  .ja va 2 s.c o m*/
    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);
    }/*w ww .j  a  v  a  2 s .c o  m*/
    try {
        tx.rollback();
    } catch (ResourceException e) {
        XAException ee = new XAException(XAException.XAER_RMERR);
        ee.initCause(e);
        throw ee;
    }
    transactions.remove(xid);
}