Example usage for javax.transaction.xa XAException XA_RBPROTO

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

Introduction

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

Prototype

int XA_RBPROTO

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

Click Source Link

Document

A protocol error occurred in the resource manager.

Usage

From source file:org.apache.hadoop.hbase.client.transactional.JtaXAResource.java

public int prepare(final Xid xid) throws XAException {
    LOG.trace("prepare [" + xid.toString() + "] ");
    TransactionState state = xidToTransactionState.get(xid);
    int status;/*from  ww  w  .ja va  2s.c om*/
    try {
        status = this.transactionManager.prepareCommit(state);
    } catch (CommitUnsuccessfulException e) {
        XAException xae = new XAException(XAException.XA_HEURRB);
        xae.initCause(e);
        throw xae;
    } catch (IOException e) {
        XAException xae = new XAException(XAException.XAER_RMERR);
        xae.initCause(e);
        throw xae;
    }

    switch (status) {
    case TransactionalReturn.COMMIT_OK:
        return XAResource.XA_OK;
    case TransactionalReturn.COMMIT_OK_READ_ONLY:
        return XAResource.XA_RDONLY;
    default:
        throw new XAException(XAException.XA_RBPROTO);
    }
}