Example usage for javax.transaction.xa XAException XA_RBOTHER

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

Introduction

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

Prototype

int XA_RBOTHER

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

Click Source Link

Document

The resource manager rolled back the transaction branch for a reason not on this list.

Usage

From source file:com.taobao.metamorphosis.server.transaction.LocalTransaction.java

@Override
public void commit(final boolean onePhase) throws XAException, IOException {
    if (LOG.isDebugEnabled()) {
        LOG.debug("commit: " + this.xid);
    }//from  w  ww  .java  2  s. c o m

    // Get ready for commit.
    try {
        this.prePrepare();
    } catch (final XAException e) {
        throw e;
    } catch (final Throwable e) {
        LOG.warn("COMMIT FAILED: ", e);
        this.rollback();
        // Let them know we rolled back.
        final XAException xae = new XAException("COMMIT FAILED: Transaction rolled back.");
        xae.errorCode = XAException.XA_RBOTHER;
        xae.initCause(e);
        throw xae;
    }

    this.setState(Transaction.FINISHED_STATE);
    this.context.getTransactions().remove(this.xid);
    try {
        this.transactionStore.commit(this.getTransactionId(), false);
    } catch (final Throwable t) {
        LOG.warn("Store COMMIT FAILED: ", t);
        this.rollback();
        final XAException xae = new XAException("STORE COMMIT FAILED: Transaction rolled back.");
        xae.errorCode = XAException.XA_RBOTHER;
        xae.initCause(t);
        throw xae;
    }
}

From source file:com.taobao.metamorphosis.server.transaction.XATransaction.java

private void storeCommit(final TransactionId txid, final boolean wasPrepared) throws XAException, IOException {
    try {/*  www. j  a v  a2s.  com*/
        this.transactionStore.commit(this.getTransactionId(), wasPrepared);
    } catch (final Throwable t) {
        LOG.warn("Store COMMIT FAILED: ", t);
        this.rollback();
        final XAException xae = new XAException("STORE COMMIT FAILED: Transaction rolled back.");
        xae.errorCode = XAException.XA_RBOTHER;
        xae.initCause(t);
        throw xae;
    }
}

From source file:com.taobao.metamorphosis.server.transaction.XATransaction.java

private void doPrePrepare() throws XAException, IOException {
    try {//from   w w w. j  a  v  a2 s .  c o m
        this.prePrepare();
    } catch (final XAException e) {
        throw e;
    } catch (final Throwable e) {
        LOG.warn("PRE-PREPARE FAILED: ", e);
        this.rollback();
        final XAException xae = new XAException("PRE-PREPARE FAILED: Transaction rolled back.");
        xae.errorCode = XAException.XA_RBOTHER;
        xae.initCause(e);
        throw xae;
    }
}

From source file:org.apache.slide.store.mem.AbstractTransientStore.java

public void commit(Xid xid, boolean onePhase) throws XAException {
    debug("commit {0} {1}", xid, onePhase ? "true" : "false");
    try {/*from w  w w .j  av a 2 s  . c o m*/
        this.xaResource.commit(xid, onePhase);
    } catch (ConflictException e) {
        this.xaResource.rollback(xid);
        // TODO it would be great if we could throw something
        // that would (on the webdav layer) leads to a 409 Conflict
        // instead of 500 Internal Server Error
        throw new XAException(XAException.XA_RBOTHER); // ??
    }
}