}
public void commit(LocalTransaction localTransaction, boolean isOnePhase) throws XAException {
if (trace) log.tracef("Committing transaction %s", localTransaction.getGlobalTransaction());
try {
LocalTxInvocationContext ctx = icc.createTxInvocationContext();
ctx.setLocalTransaction(localTransaction);
if (configuration.isOnePhaseCommit() || isOnePhase) {
validateNotMarkedForRollback(localTransaction);
if (trace) log.trace("Doing an 1PC prepare call on the interceptor chain");
PrepareCommand command = commandsFactory.buildPrepareCommand(localTransaction.getGlobalTransaction(), localTransaction.getModifications(), true);
try {
invoker.invoke(ctx, command);
txTable.removeLocalTransaction(localTransaction);
} catch (Throwable e) {
txTable.failureCompletingTransaction(ctx.getTransaction());
log.errorProcessing1pcPrepareCommand(e);
throw new XAException(XAException.XAER_RMERR);
}
} else {
handleTopologyChanges(localTransaction);
CommitCommand commitCommand = commandsFactory.buildCommitCommand(localTransaction.getGlobalTransaction());
try {
invoker.invoke(ctx, commitCommand);
txTable.removeLocalTransaction(localTransaction);
} catch (Throwable e) {
txTable.failureCompletingTransaction(ctx.getTransaction());
log.errorProcessing1pcPrepareCommand(e);
throw new XAException(XAException.XAER_RMERR);
}
}
} finally {