Example usage for javax.transaction.xa XAException XA_HEURHAZ

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

Introduction

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

Prototype

int XA_HEURHAZ

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

Click Source Link

Document

The transaction branch may have been heuristically completed.

Usage

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

public void rollback(Xid xid) throws XAException {
    byte[] data = oldDataMapping.get(xid);
    OutputStream os = null;// ww w .ja  v  a 2  s  .  co  m
    try {
        if (data == null) {
            file.deleteOnExit();
        } else {
            os = new FileOutputStream(file);
            os.write(data);
        }
    } catch (Exception e) {
        throw new XAException(XAException.XA_HEURHAZ);
    } finally {
        lockedXid = null;
        if (os != null) {
            try {
                os.close();
            } catch (Exception e) {
                log.error("", e);
            }
        }
    }

}

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

public void rollback(Xid xid) throws XAException {
    for (File file : oldDataMapping.get(xid).keySet()) {
        OutputStream os = null;// ww w  . j  a v  a2 s . com
        try {
            byte[] data = oldDataMapping.get(xid).get(file);
            if (data != null) {
                os = new FileOutputStream(file);
                os.write(oldDataMapping.get(xid).get(file));
            } else {
                file.deleteOnExit();
            }
        } catch (Exception e) {
            throw new XAException(XAException.XA_HEURHAZ);
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (Exception e) {
                    log.error("", e);
                }
            }
            lockedXid = null;
            modifiedDataMapping.remove(xid);
            oldDataMapping.remove(xid);
        }
    }
}