List of usage examples for javax.transaction.xa XAException XAER_RMERR
int XAER_RMERR
To view the source code for javax.transaction.xa XAException XAER_RMERR.
Click Source Link
From source file:org.eclipse.ecr.core.storage.sql.SessionImpl.java
@Override public void end(Xid xid, int flags) throws XAException { boolean failed = true; try {/*from w ww .ja v a 2 s . c om*/ if (flags != TMFAIL) { try { flush(); } catch (Exception e) { String msg = "Could not end transaction"; if (e instanceof ConcurrentModificationException) { log.debug(msg, e); } else { log.error(msg, e); } throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e); } } failed = false; mapper.end(xid, flags); } finally { if (failed) { try { mapper.end(xid, TMFAIL); } finally { rollback(xid); } } } }
From source file:org.eclipse.ecr.core.storage.sql.SessionImpl.java
@Override public void commit(Xid xid, boolean onePhase) throws XAException { try {/*from ww w . j a v a2 s .c om*/ mapper.commit(xid, onePhase); } finally { inTransaction = false; try { try { sendInvalidationsToOthers(); } finally { checkThreadEnd(); } } catch (Exception e) { log.error("Could not commit transaction", e); throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e); } } }
From source file:org.mule.util.xa.DefaultXASession.java
public void end(Xid xid, int flags) throws XAException { if (logger.isDebugEnabled()) { logger.debug(new StringBuffer(128).append("Thread ").append(Thread.currentThread()) .append(flags == TMSUSPEND ? " suspends" : flags == TMFAIL ? " fails" : " ends") .append(" work on behalf of transaction branch ").append(xid).toString()); }//from w w w .j a v a 2s .c om // No transaction is already begun if (localContext == null) { throw new XAException(XAException.XAER_NOTA); } // This session has already been associated with an xid if (localXid == null || !localXid.equals(xid)) { throw new XAException(XAException.XAER_PROTO); } try { switch (flags) { case TMSUSPEND: // TODO: suspend context resourceManager.addSuspendedTransactionalResource(localXid, localContext); resourceManager.removeActiveTransactionalResource(localXid); break; case TMFAIL: resourceManager.setTransactionRollbackOnly(localContext); break; case TMSUCCESS: // no-op default: // no-op break; } } catch (ResourceManagerException e) { throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e); } localXid = null; localContext = null; }
From source file:org.mule.util.xa.DefaultXASession.java
public void commit(Xid xid, boolean onePhase) throws XAException { if (xid == null) { throw new XAException(XAException.XAER_PROTO); }//ww w .j a va 2s .co m AbstractTransactionContext context = resourceManager.getActiveTransactionalResource(xid); if (context == null) { throw new XAException(XAException.XAER_NOTA); } if (logger.isDebugEnabled()) { logger.debug("Committing transaction branch " + xid); } if (context.status == Status.STATUS_MARKED_ROLLBACK) { throw new XAException(XAException.XA_RBROLLBACK); } try { if (context.status != Status.STATUS_PREPARED) { if (onePhase) { resourceManager.prepareTransaction(context); } else { throw new XAException(XAException.XAER_PROTO); } } resourceManager.commitTransaction(context); } catch (ResourceManagerException e) { throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e); } resourceManager.removeActiveTransactionalResource(xid); resourceManager.removeSuspendedTransactionalResource(xid); }
From source file:org.mule.util.xa.DefaultXASession.java
public void rollback(Xid xid) throws XAException { if (xid == null) { throw new XAException(XAException.XAER_PROTO); }/*from w ww .j a v a 2 s. c o m*/ AbstractTransactionContext context = resourceManager.getActiveTransactionalResource(xid); if (context == null) { throw new XAException(XAException.XAER_NOTA); } if (logger.isDebugEnabled()) { logger.debug("Rolling back transaction branch " + xid); } try { resourceManager.rollbackTransaction(context); } catch (ResourceManagerException e) { throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e); } resourceManager.removeActiveTransactionalResource(xid); resourceManager.removeSuspendedTransactionalResource(xid); }
From source file:org.mule.util.xa.DefaultXASession.java
public int prepare(Xid xid) throws XAException { if (xid == null) { throw new XAException(XAException.XAER_PROTO); }/*from w w w. java 2s . com*/ AbstractTransactionContext context = resourceManager.getTransactionalResource(xid); if (context == null) { throw new XAException(XAException.XAER_NOTA); } if (logger.isDebugEnabled()) { logger.debug("Preparing transaction branch " + xid); } if (context.status == Status.STATUS_MARKED_ROLLBACK) { throw new XAException(XAException.XA_RBROLLBACK); } try { return resourceManager.prepareTransaction(context); } catch (ResourceManagerException e) { throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e); } }
From source file:org.nuxeo.ecm.core.blob.storage.impl.XASession.java
public void commit(Xid xid, boolean onePhase) throws XAException { TransactionContext tx = (TransactionContext) transactions.get(xid); if (tx == null) { throw new XAException(XAException.XAER_NOTA); }/* w w w . j a v a 2 s. co m*/ try { if (onePhase) { tx.prepare(); } tx.commit(); } catch (ResourceException e) { XAException ee = new XAException(XAException.XAER_RMERR); ee.initCause(e); throw ee; } transactions.remove(xid); }
From source file:org.nuxeo.ecm.core.blob.storage.impl.XASession.java
public int prepare(Xid xid) throws XAException { TransactionContext tx = (TransactionContext) transactions.get(xid); if (tx == null) { throw new XAException(XAException.XAER_NOTA); }//from ww w.j av a 2 s . c o m try { tx.prepare(); } catch (ResourceException e) { XAException ee = new XAException(XAException.XAER_RMERR); ee.initCause(e); throw ee; } return XA_OK; }
From source file:org.nuxeo.ecm.core.blob.storage.impl.XASession.java
public void rollback(Xid xid) throws XAException { TransactionContext tx = (TransactionContext) transactions.get(xid); if (tx == null) { throw new XAException(XAException.XAER_NOTA); }/*w w w.j a v a 2 s . c o m*/ try { tx.rollback(); } catch (ResourceException e) { XAException ee = new XAException(XAException.XAER_RMERR); ee.initCause(e); throw ee; } transactions.remove(xid); }
From source file:org.nuxeo.ecm.core.storage.sql.jdbc.JDBCMapper.java
@Override public void start(Xid xid, int flags) throws XAException { try {//from ww w . jav a 2 s.c om checkConnectionValid(); xaresource.start(xid, flags); if (logger.isLogEnabled()) { logger.log("XA start on " + systemToString(xid)); } } catch (StorageException e) { throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e); } catch (XAException e) { checkConnectionReset(e); logger.error("XA start error on " + systemToString(xid), e); throw e; } }