public Object call() throws Exception { doPreCommit(); return null; } });
public Object call() throws Exception { doPostCommit(); return null; } });
private void checkForPreparedState(boolean onePhase) throws XAException { if (!onePhase) { XAException xae = newXAException("Cannot do 2 phase commit if the transaction has not been prepared", XAException.XAER_PROTO); throw xae; } }
protected void doPostCommit() throws XAException { try { setCommitted(true); fireAfterCommit(); } catch (Throwable e) { // I guess this could happen. Post commit task failed // to execute properly. getLog().warn("POST COMMIT FAILED: ", e); XAException xae = newXAException("POST COMMIT FAILED", XAException.XAER_RMERR); xae.initCause(e); throw xae; } }
public void setRollbackOnly(Throwable cause) { if (!isRollbackOnly()) { getLog().trace("setting rollback only, cause:", cause); rollackOnlyCause = cause; } }
private void registerSync(ActiveMQDestination destination, Transaction transaction, BaseCommand command) { Synchronization sync = new PreparedDestinationCompletion(this, destination, command.isMessage()); // ensure one per destination in the list Synchronization existing = transaction.findMatching(sync); if (existing != null) { ((PreparedDestinationCompletion)existing).incrementOpCount(); } else { transaction.addSynchronization(sync); } }
@Override public String toString() { return "Local-" + getTransactionId() + "[synchronizations=" + synchronizations + "]"; }
public void rollbackTransaction(ConnectionContext context, TransactionId xid) throws Exception { Transaction transaction = getTransaction(context, xid, true); transaction.rollback(); }
@Override public void heuristicRollback() throws Exception { transaction.rollback(); } }
public boolean isPrepared() { return getState() == PREPARED_STATE; }
@Override public byte[] getGlobalTransactionId() { return transaction.getXid().getGlobalTransactionId(); }
public int prepareTransaction(ConnectionContext context, TransactionId xid) throws Exception { Transaction transaction = getTransaction(context, xid, false); return transaction.prepare(); }
public void commitTransaction(ConnectionContext context, TransactionId xid, boolean onePhase) throws Exception { Transaction transaction = getTransaction(context, xid, true); transaction.commit(onePhase); }
private void setStateFinished() { setState(Transaction.FINISHED_STATE); broker.removeTransaction(xid); }
public RecoveredXATransactionView(final ManagedRegionBroker managedRegionBroker, final XATransaction transaction) { this.transaction = transaction; transaction.addSynchronization(new Synchronization() { @Override public void afterCommit() throws Exception { managedRegionBroker.unregister(transaction); } @Override public void afterRollback() throws Exception { managedRegionBroker.unregister(transaction); } }); }
@Override public void heuristicCommit() throws Exception { transaction.commit(false); }
public void forgetTransaction(ConnectionContext context, TransactionId xid) throws Exception { Transaction transaction = getTransaction(context, xid, true); transaction.rollback(); }
@Override public int getFormatId() { return transaction.getXid().getFormatId(); }
private void illegalStateTransition(String callName) throws XAException { XAException xae = newXAException("Cannot call " + callName + " now.", XAException.XAER_PROTO); throw xae; }
@Override public byte[] getBranchQualifier() { return transaction.getXid().getBranchQualifier(); }