public void rollback(Xid xid, Object logMark) throws LogException { throw new LogException("JDBCLog does not support rollback of prepared transactions. Use it only on servers that do not import transactions"); }
public void commit(Xid xid, Object logMark) throws LogException { try { Connection connection = dataSource.getConnection(); try { PreparedStatement ps = connection.prepareStatement(DELETE_XID); try { ps.setString(0, systemId); ps.setInt(1, xid.getFormatId()); ps.setBytes(2, xid.getGlobalTransactionId()); ps.setBytes(3, xid.getBranchQualifier()); ps.execute(); } finally { ps.close(); } if (!connection.getAutoCommit()) { connection.commit(); } } finally { connection.close(); } } catch (SQLException e) { throw new LogException("Failure during prepare or commit", e); } }
public void commit(Xid xid, Object logMark) throws LogException { //the data is theoretically unnecessary but is included to help with debugging and because HOWL currently requires it. byte[][] data = new byte[4][]; data[0] = new byte[]{COMMIT}; data[1] = intToBytes(xid.getFormatId()); data[2] = xid.getGlobalTransactionId(); data[3] = xid.getBranchQualifier(); try { logger.putDone(data, (XACommittingTx) logMark); // logger.putDone(null, (XACommittingTx) logMark); } 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 void commit(Xid xid, Object logMark) throws LogException { //the data is theoretically unnecessary but is included to help with debugging and because HOWL currently requires it. byte[][] data = new byte[4][]; data[0] = new byte[]{COMMIT}; data[1] = intToBytes(xid.getFormatId()); data[2] = xid.getGlobalTransactionId(); data[3] = xid.getBranchQualifier(); try { logger.putDone(data, (XACommittingTx) logMark); // logger.putDone(null, (XACommittingTx) logMark); } 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 void rollback(Xid xid, Object logMark) throws LogException { //the data is theoretically unnecessary but is included to help with debugging and because HOWL currently requires it. byte[][] data = new byte[4][]; data[0] = new byte[]{ROLLBACK}; data[1] = intToBytes(xid.getFormatId()); data[2] = xid.getGlobalTransactionId(); data[3] = xid.getBranchQualifier(); try { logger.putDone(data, (XACommittingTx) logMark); // logger.putDone(null, (XACommittingTx) logMark); } 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 void rollback(Xid xid, Object logMark) throws LogException { //the data is theoretically unnecessary but is included to help with debugging and because HOWL currently requires it. byte[][] data = new byte[4][]; data[0] = new byte[]{ROLLBACK}; data[1] = intToBytes(xid.getFormatId()); data[2] = xid.getGlobalTransactionId(); data[3] = xid.getBranchQualifier(); try { logger.putDone(data, (XACommittingTx) logMark); // logger.putDone(null, (XACommittingTx) logMark); } 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 void rollback(Xid xid, Object logMark) throws LogException { //the data is theoretically unnecessary but is included to help with debugging and because HOWL currently requires it. byte[][] data = new byte[4][]; data[0] = new byte[]{ROLLBACK}; data[1] = intToBytes(xid.getFormatId()); data[2] = xid.getGlobalTransactionId(); data[3] = xid.getBranchQualifier(); try { logger.putDone(data, (XACommittingTx) logMark); // logger.putDone(null, (XACommittingTx) logMark); } 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 void commit(Xid xid, Object logMark) throws LogException { //the data is theoretically unnecessary but is included to help with debugging and because HOWL currently requires it. byte[][] data = new byte[4][]; data[0] = new byte[]{COMMIT}; data[1] = intToBytes(xid.getFormatId()); data[2] = xid.getGlobalTransactionId(); data[3] = xid.getBranchQualifier(); try { logger.putDone(data, (XACommittingTx) logMark); // logger.putDone(null, (XACommittingTx) logMark); } 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 void commit(Xid xid, Object logMark) throws LogException { //the data is theoretically unnecessary but is included to help with debugging and because HOWL currently requires it. byte[][] data = new byte[4][]; data[0] = new byte[]{COMMIT}; data[1] = intToBytes(xid.getFormatId()); data[2] = xid.getGlobalTransactionId(); data[3] = xid.getBranchQualifier(); try { logger.putDone(data, (XACommittingTx) logMark); // logger.putDone(null, (XACommittingTx) logMark); } 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 void rollback(Xid xid, Object logMark) throws LogException { //the data is theoretically unnecessary but is included to help with debugging and because HOWL currently requires it. byte[][] data = new byte[4][]; data[0] = new byte[]{ROLLBACK}; data[1] = intToBytes(xid.getFormatId()); data[2] = xid.getGlobalTransactionId(); data[3] = xid.getBranchQualifier(); try { logger.putDone(data, (XACommittingTx) logMark); // logger.putDone(null, (XACommittingTx) logMark); } 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); } }
throw new LogException("Failure during prepare or commit", 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); } }
throw new LogException("Recovery failure", 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); } }