Example usage for javax.transaction.xa XAException XA_RBBASE

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

Introduction

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

Prototype

int XA_RBBASE

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

Click Source Link

Document

The inclusive lower bound of the rollback codes.

Usage

From source file:com.clican.pluto.transaction.resources.memory.XAFileResourceMemoryImpl.java

public int prepare(Xid xid) throws XAException {

    InputStream is = null;//from ww  w .jav  a 2 s.c  o m
    try {
        if (file.exists()) {
            is = new FileInputStream(file);
            byte[] data = new byte[is.available()];
            is.read(data);
            oldDataMapping.put(xid, data);
        } else {
            oldDataMapping.put(xid, null);
        }
    } catch (Exception e) {
        log.error("", e);
        throw new XAException(XAException.XA_RBBASE);
    } finally {
        if (is != null) {
            try {
                is.close();
            } catch (Exception e) {
                log.error("", e);
            }
        }
    }
    return XA_OK;
}

From source file:com.clican.pluto.transaction.resources.memory.XAFileSetResourceMemoryImpl.java

public int prepare(Xid xid) throws XAException {
    InputStream is = null;/*from  ww w  .  j a v a  2  s. c  o  m*/
    try {
        for (File f : modifiedDataMapping.get(xid).keySet()) {
            if (f.exists()) {
                is = new FileInputStream(f);
                byte[] data = new byte[is.available()];
                is.read(data);
                oldDataMapping.get(xid).put(f, data);
            } else {
                oldDataMapping.get(xid).put(f, null);
            }
        }
    } catch (Exception e) {
        log.error("", e);
        throw new XAException(XAException.XA_RBBASE);
    } finally {
        if (is != null) {
            try {
                is.close();
            } catch (Exception e) {
                log.error("", e);
            }
        }
    }
    return XA_OK;
}