private boolean isNameInTransaction(XidBranchesPair xidBranchesPair, String name, Xid xid) { for (TransactionBranchInfo transactionBranchInfo : xidBranchesPair.getBranches()) { if (name.equals(transactionBranchInfo.getResourceName()) && equals(xid, transactionBranchInfo.getBranchXid())) { return true; } } return false; }
ps.setBytes(2, globalTransactionId); ps.setBytes(3, branchQualifier); ps.setBytes(4, branch.getBranchXid().getBranchQualifier()); ps.setString(5, branch.getResourceName()); ps.execute();
public Object prepare(Xid xid, List branches) throws LogException { int branchCount = branches.size(); byte[][] data = new byte[3 + 2 * branchCount][]; data[0] = intToBytes(xid.getFormatId()); data[1] = xid.getGlobalTransactionId(); data[2] = xid.getBranchQualifier(); int i = 3; for (Iterator iterator = branches.iterator(); iterator.hasNext();) { TransactionBranchInfo transactionBranchInfo = (TransactionBranchInfo) iterator.next(); data[i++] = transactionBranchInfo.getBranchXid().getBranchQualifier(); data[i++] = transactionBranchInfo.getResourceName().getBytes(); } try { XACommittingTx committingTx = logger.putCommit(data); return committingTx; } catch (LogClosedException e) { throw (IllegalStateException) new IllegalStateException().initCause(e); } catch (LogRecordSizeException e) { throw (IllegalStateException) new IllegalStateException().initCause(e); } catch (LogFileOverflowException e) { throw (IllegalStateException) new IllegalStateException().initCause(e); } catch (InterruptedException e) { throw (IllegalStateException) new IllegalStateException().initCause(e); } catch (IOException e) { throw new LogException(e); } }
public Object prepare(Xid xid, List branches) throws LogException { int branchCount = branches.size(); byte[][] data = new byte[3 + 2 * branchCount][]; data[0] = intToBytes(xid.getFormatId()); data[1] = xid.getGlobalTransactionId(); data[2] = xid.getBranchQualifier(); int i = 3; for (Iterator iterator = branches.iterator(); iterator.hasNext();) { TransactionBranchInfo transactionBranchInfo = (TransactionBranchInfo) iterator.next(); data[i++] = transactionBranchInfo.getBranchXid().getBranchQualifier(); data[i++] = transactionBranchInfo.getResourceName().getBytes(); } try { XACommittingTx committingTx = logger.putCommit(data); return committingTx; } catch (LogClosedException e) { throw (IllegalStateException) new IllegalStateException().initCause(e); } catch (LogRecordSizeException e) { throw (IllegalStateException) new IllegalStateException().initCause(e); } catch (LogFileOverflowException e) { throw (IllegalStateException) new IllegalStateException().initCause(e); } catch (InterruptedException e) { throw (IllegalStateException) new IllegalStateException().initCause(e); } catch (IOException e) { throw new LogException(e); } }
public Object prepare(Xid xid, List branches) throws LogException { int branchCount = branches.size(); byte[][] data = new byte[3 + 2 * branchCount][]; data[0] = intToBytes(xid.getFormatId()); data[1] = xid.getGlobalTransactionId(); data[2] = xid.getBranchQualifier(); int i = 3; for (Iterator iterator = branches.iterator(); iterator.hasNext();) { TransactionBranchInfo transactionBranchInfo = (TransactionBranchInfo) iterator.next(); data[i++] = transactionBranchInfo.getBranchXid().getBranchQualifier(); data[i++] = transactionBranchInfo.getResourceName().getBytes(); } try { XACommittingTx committingTx = logger.putCommit(data); return committingTx; } catch (LogClosedException e) { throw (IllegalStateException) new IllegalStateException().initCause(e); } catch (LogRecordSizeException e) { throw (IllegalStateException) new IllegalStateException().initCause(e); } catch (LogFileOverflowException e) { throw (IllegalStateException) new IllegalStateException().initCause(e); } catch (InterruptedException e) { throw (IllegalStateException) new IllegalStateException().initCause(e); } catch (IOException e) { throw new LogException(e); } }
public Object prepare(Xid xid, List<? extends TransactionBranchInfo> branches) throws LogException { int branchCount = branches.size(); byte[][] data = new byte[3 + 2 * branchCount][]; data[0] = intToBytes(xid.getFormatId()); data[1] = xid.getGlobalTransactionId(); data[2] = xid.getBranchQualifier(); int i = 3; for (TransactionBranchInfo transactionBranchInfo : branches) { data[i++] = transactionBranchInfo.getBranchXid().getBranchQualifier(); data[i++] = transactionBranchInfo.getResourceName().getBytes(); } try { XACommittingTx committingTx = logger.putCommit(data); return committingTx; } catch (LogClosedException e) { throw (IllegalStateException) new IllegalStateException().initCause(e); } catch (LogRecordSizeException e) { throw (IllegalStateException) new IllegalStateException().initCause(e); } catch (LogFileOverflowException e) { throw (IllegalStateException) new IllegalStateException().initCause(e); } catch (InterruptedException e) { throw (IllegalStateException) new IllegalStateException().initCause(e); } catch (IOException e) { throw new LogException(e); } }
log.info(NLS.MESSAGES.getMessage("tx.log.migrate.xid", xidBranchesPair.getXid())); for (TransactionBranchInfo branchInfo : xidBranchesPair.getBranches()) { log.info(NLS.MESSAGES.getMessage("tx.log.migrate.xid.branch", branchInfo.getBranchXid(), branchInfo.getResourceName()));