List of usage examples for javax.transaction.xa XAException XAER_DUPID
int XAER_DUPID
To view the source code for javax.transaction.xa XAException XAER_DUPID.
Click Source Link
From source file:com.alibaba.napoli.metamorphosis.client.transaction.TransactionContext.java
@Override public void start(final Xid xid, final int flags) throws XAException { if (LOG.isDebugEnabled()) { LOG.debug("Start: " + xid); }//from w ww . java 2 s . c om if ((flags & TMJOIN) == TMJOIN || (flags & TMRESUME) == TMRESUME) { // resumexid?xid if (!this.equals(this.associatedXid, xid)) { throw new XAException(XAException.XAER_NOTA); } } if (this.isInLocalTransaction()) { throw new XAException(XAException.XAER_PROTO); } if (this.associatedXid != null) { throw new XAException(XAException.XAER_DUPID); } this.setXid(xid); }
From source file:org.apache.slide.store.txfile.AbstractTxFileStoreService.java
protected XAException createXAException(ResourceManagerException e) { if (e.getStatus() == ResourceManagerException.ERR_DUP_TX) { return new XAException(XAException.XAER_DUPID); } else if (e.getStatus() == ResourceManagerException.ERR_TXID_INVALID) { return new XAException(XAException.XAER_NOTA); } else {//from www . ja va 2 s .c om return new XAException(e.toString()); } }
From source file:org.enhydra.jdbc.standard.StandardXADataSource.java
/** * Returns the connection associated with a given XID. * is reached, the Xid is found or an exception is thrown. *//*w w w .j ava2s.co m*/ synchronized StandardXAStatefulConnection getConnection(Xid xid, boolean mustFind) throws XAException { log.debug("StandardXADataSource:getConnection (xid=" + xid + ", mustFind=" + mustFind + ")"); Object o = xidConnections.get(xid); // lookup the connection by XID log.debug("XID: " + o); StandardXAStatefulConnection cur = (StandardXAStatefulConnection) o; // cast to something more convenient if (mustFind) { // if we expected to find the connection if (cur == null) { // and we didn't log.debug("StandardXADataSource:getConnection (StatefulConnection is null)"); checkTimeouts(xid); // see if it's been freed during a timeout throw new XAException(XAException.XAER_NOTA); // not a valid XID } } else { // didn't expect to find the connection if (cur != null) { // but we found it anyway throw new XAException(XAException.XAER_DUPID); // duplicate XID } } log.debug("StandardXADataSource:getConnection return connection associated with a given XID"); return cur; }
From source file:org.nuxeo.ecm.core.blob.storage.impl.XASession.java
public void start(Xid xid, int flags) throws XAException { if (isAssociated()) { log.error("Resource already associated with a transaction."); throw new XAException(XAException.XAER_PROTO); }//from w w w .j a v a2 s . co m TransactionContext tx = (TransactionContext) transactions.get(xid); if (flags == TMNOFLAGS) { if (tx != null) { throw new XAException(XAException.XAER_DUPID); } tx = createTransaction(xid); } else if (flags == TMJOIN) { if (tx == null) { throw new XAException(XAException.XAER_NOTA); } } else if (flags == TMRESUME) { if (tx == null) { throw new XAException(XAException.XAER_NOTA); } if (!tx.isSuspended()) { log.error("Unable to resume: transaction not suspended."); throw new XAException(XAException.XAER_PROTO); } tx.setSuspended(false); } else { throw new XAException(XAException.XAER_INVAL); } associate(tx); }