Source:
<code>public final CompletionStage<Integer> prepare(LocalTransaction localTransaction, boolean replayEntryWrapping) { CompletionStage<Integer> markRollbackStage = validateNotMarkedForRollback(localTransaction); if (markRollbackStage != null) { return markRollbackStage; } if (isOnePhaseCommit(localTransaction)) { if (trace) log.tracef("Received prepare for tx: %s. Skipping call as 1PC will be used.", localTransaction); return XA_OKAY_STAGE; } PrepareCommand prepareCommand = commandCreator.createPrepareCommand(localTransaction.getGlobalTransaction(), localTransaction.getModifications(), false); if (trace) log.tracef("Sending prepare command through the chain: %s", prepareCommand); LocalTxInvocationContext ctx = icf.running().createTxInvocationContext(localTransaction); prepareCommand.setReplayEntryWrapping(replayEntryWrapping); CompletionStage<Object> prepareStage = invoker.running().invokeAsync(ctx, prepareCommand); return CompletionStages.handleAndCompose(prepareStage, (ignore, t) -> { if (t != null) { if (shuttingDown) log.trace("Exception while preparing back, probably because we're shutting down."); else log.errorProcessingPrepare(t); return CompletionStages.handleAndCompose(rollback(localTransaction), (ignore2, innerT) -> { XAException xe = new XAException(XAException.XA_RBROLLBACK); if (innerT != null) { innerT.addSuppressed(t); <START> xe.initCause(innerT); <END> } else { xe.initCause(t); } return CompletableFutures.completedExceptionFuture(xe); }); } if (localTransaction.isReadOnly()) { if (trace) log.tracef("Readonly transaction: %s", localTransaction.getGlobalTransaction()); return commitInternal(ctx) .thenApply(XA_RDONLY_APPLY); } else { txTable.running().localTransactionPrepared(localTransaction); return XA_OKAY_STAGE; } }); }</code><technical_language>I prefer prepare exception rollback exception suppressed. rename innerT rollbackThrowable t prepareThrowable</technical_language>

Target:
public final CompletionStage<Integer> prepare(LocalTransaction localTransaction, boolean replayEntryWrapping) { CompletionStage<Integer> markRollbackStage = validateNotMarkedForRollback(localTransaction); if (markRollbackStage != null) { return markRollbackStage; } if (isOnePhaseCommit(localTransaction)) { if (trace) log.tracef("Received prepare for tx: %s. Skipping call as 1PC will be used.", localTransaction); return XA_OKAY_STAGE; } PrepareCommand prepareCommand = commandCreator.createPrepareCommand(localTransaction.getGlobalTransaction(), localTransaction.getModifications(), false); if (trace) log.tracef("Sending prepare command through the chain: %s", prepareCommand); LocalTxInvocationContext ctx = icf.running().createTxInvocationContext(localTransaction); prepareCommand.setReplayEntryWrapping(replayEntryWrapping); CompletionStage<Object> prepareStage = invoker.running().invokeAsync(ctx, prepareCommand); return CompletionStages.handleAndCompose(prepareStage, (ignore, prepareThrowable) -> { if (prepareThrowable != null) { if (shuttingDown) log.trace("Exception while preparing back, probably because we're shutting down."); else log.errorProcessingPrepare(prepareThrowable); return CompletionStages.handleAndCompose(rollback(localTransaction), (ignore2, rollbackThrowable) -> { XAException xe = new XAException(XAException.XA_RBROLLBACK); if (rollbackThrowable != null) { rollbackThrowable.addSuppressed(prepareThrowable); xe.initCause(rollbackThrowable); } else { xe.initCause(prepareThrowable); } return CompletableFutures.completedExceptionFuture(xe); }); } if (localTransaction.isReadOnly()) { if (trace) log.tracef("Readonly transaction: %s", localTransaction.getGlobalTransaction()); return commitInternal(ctx) .thenApply(XA_RDONLY_APPLY); } else { txTable.running().localTransactionPrepared(localTransaction); return XA_OKAY_STAGE; } }); }