List of usage examples for javax.transaction.xa Xid getFormatId
int getFormatId();
From source file:com.taobao.metamorphosis.transaction.XATransactionId.java
public XATransactionId(final Xid xid, final String uniqueQualifier) { this.formatId = xid.getFormatId(); this.globalTransactionId = xid.getGlobalTransactionId(); this.branchQualifier = xid.getBranchQualifier(); this.uniqueQualifier = uniqueQualifier; if (StringUtils.isBlank(uniqueQualifier)) { throw new IllegalArgumentException("Blank uniqueQualifier"); }/*from ww w .ja v a 2s. co m*/ }
From source file:com.alibaba.napoli.metamorphosis.client.transaction.TransactionContext.java
private boolean equals(final Xid xid1, final Xid xid2) { if (xid1 == xid2) { return true; }/* w ww . j av a 2 s . co m*/ if (xid1 == null || xid2 == null) { return false; } return xid1.getFormatId() == xid2.getFormatId() && Arrays.equals(xid1.getBranchQualifier(), xid2.getBranchQualifier()) && Arrays.equals(xid1.getGlobalTransactionId(), xid2.getGlobalTransactionId()); }
From source file:org.eclipse.ecr.core.storage.sql.jdbc.JDBCMapper.java
@Override public void start(Xid xid, int flags) throws XAException { try {/*from w w w. jav a 2s . c o m*/ checkConnectionValid(); xaresource.start(xid, flags); if (log.isDebugEnabled()) { log.debug("XA start on " + xid.getFormatId()); } } catch (StorageException e) { throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e); } catch (XAException e) { checkConnectionReset(e); log.error("XA start error on " + xid.getFormatId(), e); throw e; } }
From source file:org.eclipse.ecr.core.storage.sql.jdbc.JDBCMapper.java
@Override public void end(Xid xid, int flags) throws XAException { try {// w w w. j a v a 2s . co m xaresource.end(xid, flags); if (log.isDebugEnabled()) { log.debug("XA end on " + xid.getFormatId()); } } catch (NullPointerException e) { // H2 when no active transaction log.error("XA end error on " + xid, e); throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e); } catch (XAException e) { log.error("XA end error on " + xid, e); throw e; } }
From source file:org.mule.util.xa.MuleXid.java
public MuleXid(Xid txId) { this.formatId = txId.getFormatId(); this.globalTransactionId = txId.getGlobalTransactionId(); this.branchQualifier = txId.getBranchQualifier(); }
From source file:org.mule.util.xa.MuleXid.java
@Override public boolean equals(Object obj) { if (!(obj instanceof Xid)) { return false; }/*from w ww .j a v a 2 s .co m*/ Xid other = (Xid) obj; return Arrays.equals(getGlobalTransactionId(), other.getGlobalTransactionId()) && Arrays.equals(getBranchQualifier(), other.getBranchQualifier()) && getFormatId() == other.getFormatId(); }
From source file:org.mule.util.xa.MuleXid.java
@Override public int compareTo(Xid o) { if (formatId == o.getFormatId() && Arrays.equals(globalTransactionId, o.getGlobalTransactionId()) && Arrays.equals(branchQualifier, o.getBranchQualifier())) { return 0; }/*w ww. j a v a2 s .com*/ return this.hashCode() > o.hashCode() ? 1 : -1; }
From source file:org.wso2.andes.client.XASession_9_1.java
/** * Send startDtx command to server//from w ww .ja va2 s . c om * * @param xid q global transaction identifier to be associated with the resource * @param flag one of TMNOFLAGS, TMJOIN, or TMRESUME * @return XaStatus returned by server * @throws FailoverException when a connection issue is detected * @throws AMQException when an error is detected in AMQ state manager */ XaStatus startDtx(Xid xid, int flag) throws FailoverException, AMQException, XAException { throwErrorIfClosed(); DtxStartBody dtxStartBody = methodRegistry.createDtxStartBody(xid.getFormatId(), xid.getGlobalTransactionId(), xid.getBranchQualifier(), flag == XAResource.TMJOIN, flag == XAResource.TMRESUME); AMQMethodEvent amqMethodEvent = _connection._protocolHandler .syncWrite(dtxStartBody.generateFrame(_channelId), DtxStartOkBody.class); DtxStartOkBodyImpl response = (DtxStartOkBodyImpl) amqMethodEvent.getMethod(); return XaStatus.valueOf(response.getXaResult()); }
From source file:org.wso2.andes.client.XASession_9_1.java
/** * Send endDtx command to server//w w w.j ava 2s .c o m * * @param xid a global transaction identifier to be associated with the resource * @param flag one of TMSUCCESS, TMFAIL, or TMSUSPEND. * @return XaStatus returned by server * @throws FailoverException when a connection issue is detected * @throws AMQException when an error is detected in AMQ state manager */ XaStatus endDtx(Xid xid, int flag) throws FailoverException, AMQException, XAException { throwErrorIfClosed(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Sending dtx.end for channel " + _channelId + ", xid " + xid); } DtxEndBody dtxEndBody = methodRegistry.createDtxEndBody(xid.getFormatId(), xid.getGlobalTransactionId(), xid.getBranchQualifier(), flag == XAResource.TMFAIL, flag == XAResource.TMSUSPEND); AMQMethodEvent amqMethodEvent = _connection._protocolHandler.syncWrite(dtxEndBody.generateFrame(_channelId), DtxEndOkBody.class); DtxEndOkBodyImpl response = (DtxEndOkBodyImpl) amqMethodEvent.getMethod(); return XaStatus.valueOf(response.getXaResult()); }
From source file:org.wso2.andes.client.XASession_9_1.java
XaStatus prepareDtx(Xid xid) throws FailoverException, AMQException, XAException { throwErrorIfClosed();//from w w w .j av a 2 s.c o m DtxPrepareBody dtxPrepareBody = methodRegistry.createDtxPrepareBody(xid.getFormatId(), xid.getGlobalTransactionId(), xid.getBranchQualifier()); AMQMethodEvent amqMethodEvent = _connection._protocolHandler .syncWrite(dtxPrepareBody.generateFrame(_channelId), DtxPrepareOkBody.class); DtxPrepareOkBodyImpl response = (DtxPrepareOkBodyImpl) amqMethodEvent.getMethod(); return XaStatus.valueOf(response.getXaResult()); }