TransactionImpl(TransactionManagerImpl txManager, long transactionTimeoutMilliseconds) throws SystemException { this(txManager.getXidFactory().createXid(), txManager, transactionTimeoutMilliseconds); }
public synchronized void recoverLog() throws XAException { Collection<XidBranchesPair> preparedXids; try { preparedXids = txManager.getTransactionLog().recover(txManager.getXidFactory()); } catch (LogException e) { throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e); } for (XidBranchesPair xidBranchesPair : preparedXids) { Xid xid = xidBranchesPair.getXid(); log.trace("read prepared global xid from log: " + toString(xid)); if (txManager.getXidFactory().matchesGlobalId(xid.getGlobalTransactionId())) { ourXids.put(new ByteArrayWrapper(xid.getGlobalTransactionId()), xidBranchesPair); for (TransactionBranchInfo transactionBranchInfo : xidBranchesPair.getBranches()) { log.trace("read branch from log: " + transactionBranchInfo.toString()); String name = transactionBranchInfo.getResourceName(); Set<XidBranchesPair> transactionsForName = nameToOurTxMap.get(name); if (transactionsForName == null) { transactionsForName = new HashSet<XidBranchesPair>(); nameToOurTxMap.put(name, transactionsForName); } transactionsForName.add(xidBranchesPair); } } else { log.trace("read external prepared xid from log: " + toString(xid)); TransactionImpl externalTx = new ExternalTransaction(xid, txManager, xidBranchesPair.getBranches()); externalXids.put(xid, externalTx); externalGlobalIdMap.put(xid.getGlobalTransactionId(), externalTx); } } }
Xid branchId = txManager.getXidFactory().createBranch(xid, resourceManagers.size() + 1); xaRes.start(branchId, XAResource.TMNOFLAGS);
log.trace("This xid was prepared from another XAResource, ignoring"); } else if (txManager.getXidFactory().matchesGlobalId(xid.getGlobalTransactionId())) { } else if (txManager.getXidFactory().matchesBranchId(xid.getBranchQualifier())) {