List of usage examples for org.apache.commons.transaction.util.xa TransactionalResource setStatus
public void setStatus(int status);
From source file:org.apache.slide.common.AbstractXAServiceBase.java
public int prepare(Xid xid) throws XAException { TransactionalResource ts = getTransactionalResource(xid); if (ts == null) { throw new XAException(XAException.XAER_NOTA); }/* ww w. jav a2s . c o m*/ if (getLoggerFacade().isFineEnabled()) { getLoggerFacade().logFine("Preparing transaction branch " + ts); } if (ts.getStatus() == STATUS_MARKED_ROLLBACK) { throw new XAException(XAException.XA_RBROLLBACK); } int result = ts.prepare(); ts.setStatus(STATUS_PREPARED); return result; }
From source file:org.apache.slide.common.AbstractXAServiceBase.java
public void end(Xid xid, int flags) throws XAException { TransactionalResource ts = getActiveTransactionalResource(xid); if (ts == null) { setCurrentlyActiveTransactionalResource(null); throw new XAException(XAException.XAER_NOTA); }/*w w w .j a va 2s .c o m*/ if (getCurrentlyActiveTransactionalResource() == null) { throw new XAException(XAException.XAER_INVAL); } if (getLoggerFacade().isFineEnabled()) { getLoggerFacade().logFine(new StringBuffer(128).append("Thread ").append(Thread.currentThread()) .append(flags == TMSUSPEND ? " suspends" : flags == TMFAIL ? " fails" : " ends") .append(" work on behalf of transaction branch ").append(ts).toString()); } switch (flags) { case TMSUSPEND: ts.suspend(); addSuspendedTransactionalResource(xid, ts); removeActiveTransactionalResource(xid); break; case TMFAIL: ts.setStatus(STATUS_MARKED_ROLLBACK); break; case TMSUCCESS: break; } setCurrentlyActiveTransactionalResource(null); }