TransactionImpl(XidFactory xidFactory, TransactionLog txnLog, long transactionTimeoutMilliseconds) throws SystemException { this(xidFactory.createXid(), xidFactory, txnLog, transactionTimeoutMilliseconds); }
} else if (xidFactory.matchesGlobalId(xid.getGlobalTransactionId())) { log.error("Could not roll back", e); } else if (xidFactory.matchesBranchId(xid.getBranchQualifier())) {
public void onRecord(LogRecord plainlr) { XALogRecord lr = (XALogRecord) plainlr; short recordType = lr.type; XACommittingTx tx = lr.getTx(); if (recordType == LogRecordType.XACOMMIT) { byte[][] data = tx.getRecord(); assert data[0].length == 4; int formatId = bytesToInt(data[1]); byte[] globalId = data[1]; byte[] branchId = data[2]; Xid masterXid = xidFactory.recover(formatId, globalId, branchId); Recovery.XidBranchesPair xidBranchesPair = new Recovery.XidBranchesPair(masterXid, tx); recoveredTx.put(masterXid, xidBranchesPair); log.debug("recovered prepare record for master xid: " + masterXid); for (int i = 3; i < data.length; i += 2) { byte[] branchBranchId = data[i]; String name = new String(data[i + 1]); Xid branchXid = xidFactory.recover(formatId, globalId, branchBranchId); TransactionBranchInfoImpl branchInfo = new TransactionBranchInfoImpl(branchXid, name); xidBranchesPair.addBranch(branchInfo); log.debug("recovered branch for resource manager, branchId " + name + ", " + branchXid); } } else { if(recordType != LogRecordType.END_OF_LOG) { // This value crops up every time the server is started log.warn("Received unexpected log record: " + lr +" ("+recordType+")"); } } }
public synchronized void recoverLog() throws XAException { Collection preparedXids = null; try { preparedXids = txLog.recover(xidFactory); } catch (LogException e) { throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e); } for (Iterator iterator = preparedXids.iterator(); iterator.hasNext();) { XidBranchesPair xidBranchesPair = (Recovery.XidBranchesPair) iterator.next(); Xid xid = xidBranchesPair.getXid(); if (xidFactory.matchesGlobalId(xid.getGlobalTransactionId())) { ourXids.put(new ByteArrayWrapper(xid.getGlobalTransactionId()), xidBranchesPair); for (Iterator branches = xidBranchesPair.getBranches().iterator(); branches.hasNext();) { String name = ((TransactionBranchInfo) branches.next()).getResourceName(); Set transactionsForName = (Set)nameToOurTxMap.get(name); if (transactionsForName == null) { transactionsForName = new HashSet(); nameToOurTxMap.put(name, transactionsForName); } transactionsForName.add(xidBranchesPair); } } else { TransactionImpl externalTx = new ExternalTransaction(xid, txLog, xidBranchesPair.getBranches()); externalXids.put(xid, externalTx); externalGlobalIdMap.put(xid.getGlobalTransactionId(), externalTx); } } }
Xid branchId = xidFactory.createBranch(xid, resourceManagers.size() + 1); xaRes.start(branchId, XAResource.TMNOFLAGS); activeXaResources.put(xaRes, addBranchXid(xaRes, branchId));
} else if (xidFactory.matchesGlobalId(xid.getGlobalTransactionId())) { log.error(e); } else if (xidFactory.matchesBranchId(xid.getBranchQualifier())) {
byte[] branchBranchId = rs.getBytes(3); String name = rs.getString(4); currentXid = xidFactory.recover(formatId, globalId, globalBranchId); Xid branchXid = xidFactory.recover(formatId, globalId, branchBranchId); if (!currentXid.equals(lastXid)) { xidBranchesPair = new Recovery.XidBranchesPair(currentXid, null);
public synchronized void recoverLog() throws XAException { Collection preparedXids = null; try { preparedXids = txLog.recover(xidFactory); } catch (LogException e) { throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e); } for (Iterator iterator = preparedXids.iterator(); iterator.hasNext();) { XidBranchesPair xidBranchesPair = (Recovery.XidBranchesPair) iterator.next(); Xid xid = xidBranchesPair.getXid(); if (xidFactory.matchesGlobalId(xid.getGlobalTransactionId())) { ourXids.put(new ByteArrayWrapper(xid.getGlobalTransactionId()), xidBranchesPair); for (Iterator branches = xidBranchesPair.getBranches().iterator(); branches.hasNext();) { String name = ((TransactionBranchInfo) branches.next()).getResourceName(); Set transactionsForName = (Set)nameToOurTxMap.get(name); if (transactionsForName == null) { transactionsForName = new HashSet(); nameToOurTxMap.put(name, transactionsForName); } transactionsForName.add(xidBranchesPair); } } else { TransactionImpl externalTx = new ExternalTransaction(xid, txLog, xidBranchesPair.getBranches()); externalXids.put(xid, externalTx); externalGlobalIdMap.put(xid.getGlobalTransactionId(), externalTx); } } }
Xid branchId = xidFactory.createBranch(xid, resourceManagers.size() + 1); xaRes.start(branchId, XAResource.TMNOFLAGS); activeXaResources.put(xaRes, addBranchXid(xaRes, branchId));
} else if (xidFactory.matchesGlobalId(xid.getGlobalTransactionId())) { log.error("Could not roll back", e); } else if (xidFactory.matchesBranchId(xid.getBranchQualifier())) {
public void onRecord(LogRecord plainlr) { XALogRecord lr = (XALogRecord) plainlr; short recordType = lr.type; XACommittingTx tx = lr.getTx(); if (recordType == LogRecordType.XACOMMIT) { byte[][] data = tx.getRecord(); assert data[0].length == 4; int formatId = bytesToInt(data[1]); byte[] globalId = data[1]; byte[] branchId = data[2]; Xid masterXid = xidFactory.recover(formatId, globalId, branchId); Recovery.XidBranchesPair xidBranchesPair = new Recovery.XidBranchesPair(masterXid, tx); recoveredTx.put(masterXid, xidBranchesPair); log.debug("recovered prepare record for master xid: " + masterXid); for (int i = 3; i < data.length; i += 2) { byte[] branchBranchId = data[i]; String name = new String(data[i + 1]); Xid branchXid = xidFactory.recover(formatId, globalId, branchBranchId); TransactionBranchInfoImpl branchInfo = new TransactionBranchInfoImpl(branchXid, name); xidBranchesPair.addBranch(branchInfo); log.debug("recovered branch for resource manager, branchId " + name + ", " + branchXid); } } else { if(recordType != LogRecordType.END_OF_LOG) { // This value crops up every time the server is started log.warn("Received unexpected log record: " + lr +" ("+recordType+")"); } } }
TransactionImpl(XidFactory xidFactory, TransactionLog txnLog, long transactionTimeoutMilliseconds) throws SystemException { this(xidFactory.createXid(), xidFactory, txnLog, transactionTimeoutMilliseconds); }
public synchronized void recoverLog() throws XAException { Collection preparedXids = null; try { preparedXids = txLog.recover(xidFactory); } catch (LogException e) { throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e); } for (Iterator iterator = preparedXids.iterator(); iterator.hasNext();) { XidBranchesPair xidBranchesPair = (Recovery.XidBranchesPair) iterator.next(); Xid xid = xidBranchesPair.getXid(); if (xidFactory.matchesGlobalId(xid.getGlobalTransactionId())) { ourXids.put(new ByteArrayWrapper(xid.getGlobalTransactionId()), xidBranchesPair); for (Iterator branches = xidBranchesPair.getBranches().iterator(); branches.hasNext();) { String name = ((TransactionBranchInfo) branches.next()).getResourceName(); Set transactionsForName = (Set)nameToOurTxMap.get(name); if (transactionsForName == null) { transactionsForName = new HashSet(); nameToOurTxMap.put(name, transactionsForName); } transactionsForName.add(xidBranchesPair); } } else { TransactionImpl externalTx = new ExternalTransaction(xid, txLog, xidBranchesPair.getBranches()); externalXids.put(xid, externalTx); externalGlobalIdMap.put(xid.getGlobalTransactionId(), externalTx); } } }
Xid branchId = xidFactory.createBranch(xid, resourceManagers.size() + 1); xaRes.start(branchId, XAResource.TMNOFLAGS); activeXaResources.put(xaRes, addBranchXid(xaRes, branchId));
log.trace("This xid was prepared from another XAResource, ignoring"); } else if (txManager.getXidFactory().matchesGlobalId(xid.getGlobalTransactionId())) { } else if (txManager.getXidFactory().matchesBranchId(xid.getBranchQualifier())) {
public void onRecord(LogRecord plainlr) { XALogRecord lr = (XALogRecord) plainlr; short recordType = lr.type; XACommittingTx tx = lr.getTx(); if (recordType == LogRecordType.XACOMMIT) { byte[][] data = tx.getRecord(); assert data[0].length == 4; int formatId = bytesToInt(data[1]); byte[] globalId = data[1]; byte[] branchId = data[2]; Xid masterXid = xidFactory.recover(formatId, globalId, branchId); Recovery.XidBranchesPair xidBranchesPair = new Recovery.XidBranchesPair(masterXid, tx); recoveredTx.put(masterXid, xidBranchesPair); log.debug("recovered prepare record for master xid: " + masterXid); for (int i = 3; i < data.length; i += 2) { byte[] branchBranchId = data[i]; String name = new String(data[i + 1]); Xid branchXid = xidFactory.recover(formatId, globalId, branchBranchId); TransactionBranchInfoImpl branchInfo = new TransactionBranchInfoImpl(branchXid, name); xidBranchesPair.addBranch(branchInfo); log.debug("recovered branch for resource manager, branchId " + name + ", " + branchXid); } } else { if(recordType != LogRecordType.END_OF_LOG) { // This value crops up every time the server is started log.warn("Received unexpected log record: " + lr +" ("+recordType+")"); } } }
TransactionImpl(XidFactory xidFactory, TransactionLog txnLog, long transactionTimeoutMilliseconds) throws SystemException { this(xidFactory.createXid(), xidFactory, txnLog, 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);
public void onRecord(LogRecord plainlr) { XALogRecord lr = (XALogRecord) plainlr; short recordType = lr.type; XACommittingTx tx = lr.getTx(); if (recordType == LogRecordType.XACOMMIT) { byte[][] data = tx.getRecord(); assert data[0].length == 4; int formatId = bytesToInt(data[1]); byte[] globalId = data[1]; byte[] branchId = data[2]; Xid masterXid = xidFactory.recover(formatId, globalId, branchId); Recovery.XidBranchesPair xidBranchesPair = new Recovery.XidBranchesPair(masterXid, tx); recoveredTx.put(masterXid, xidBranchesPair); log.debug("recovered prepare record for master xid: " + masterXid); for (int i = 3; i < data.length; i += 2) { byte[] branchBranchId = data[i]; String name = new String(data[i + 1]); Xid branchXid = xidFactory.recover(formatId, globalId, branchBranchId); TransactionBranchInfoImpl branchInfo = new TransactionBranchInfoImpl(branchXid, name); xidBranchesPair.addBranch(branchInfo); log.debug("recovered branch for resource manager, branchId " + name + ", " + branchXid); } } else { if(recordType != LogRecordType.END_OF_LOG) { // This value crops up every time the server is started log.warn("Received unexpected log record: " + lr +" ("+recordType+")"); } } }