localTxContext.setLocalTransaction(localTransaction);
}
}
private Object enlistWriteAndInvokeNext(InvocationContext ctx, WriteCommand command) throws Throwable {
LocalTransaction localTransaction = null;
boolean shouldAddMod = false;
if (shouldEnlist(ctx)) {
localTransaction = enlist((TxInvocationContext) ctx);
LocalTxInvocationContext localTxContext = (LocalTxInvocationContext) ctx;
if (localModeNotForced(ctx)) shouldAddMod = true;
localTxContext.setLocalTransaction(localTransaction);
}
Object rv;
try {
rv = invokeNextInterceptor(ctx, command);
} catch (Throwable throwable) {
if (ctx.isOriginLocal() && ctx.isInTxScope()) {
TxInvocationContext txCtx = (TxInvocationContext) ctx;
txCtx.getTransaction().setRollbackOnly();
final LocalTransaction cacheTransaction = (LocalTransaction) txCtx.getCacheTransaction();
txTable.removeLocalTransaction(cacheTransaction);
}
throw throwable;
}
if (!ctx.isInTxScope())