/** * Iterates over the remote transactions and returns the XID of the one that has an internal id * equal with the supplied internal Id. */ public Xid getRemoteTransactionXid(Long internalId) { for (RemoteTransaction rTx : getRemoteTransactions()) { RecoverableTransactionIdentifier gtx = (RecoverableTransactionIdentifier) rTx.getGlobalTransaction(); if (gtx.getInternalId() == internalId) { if (log.isTraceEnabled()) log.tracef("Found xid %s matching internal id %s", gtx.getXid(), internalId); return gtx.getXid(); } } log.tracef("Could not find remote transactions matching internal id %s", internalId); return null; }
public RemoteTransaction removeRemoteTransaction(Xid xid) { if (clustered) { Iterator<RemoteTransaction> it = getRemoteTransactions().iterator(); while (it.hasNext()) { RemoteTransaction next = it.next(); RecoverableTransactionIdentifier gtx = (RecoverableTransactionIdentifier) next.getGlobalTransaction(); if (xid.equals(gtx.getXid())) { it.remove(); recalculateMinTopologyIdIfNeeded(next); next.notifyOnTransactionFinished(); return next; } } } return null; }