enlist((TxInvocationContext) ctx);
}
}
private Object enlistWriteAndInvokeNext(InvocationContext ctx, WriteCommand command) throws Throwable {
LocalTransaction localTransaction = null;
if (shouldEnlist(ctx)) {
localTransaction = enlist((TxInvocationContext) ctx);
boolean implicitWith1Pc = useOnePhaseForAutoCommitTx && localTransaction.isImplicitTransaction();
if (implicitWith1Pc) {
//in this situation we don't support concurrent updates so skip locking entirely
command.setFlags(Flag.SKIP_LOCKING);
}
}
Object rv;
try {
rv = invokeNextInterceptor(ctx, command);
} catch (Throwable throwable) {
// Don't mark the transaction for rollback if it's fail silent (i.e. putForExternalRead)
if (ctx.isOriginLocal() && ctx.isInTxScope() && !command.hasFlag(Flag.FAIL_SILENTLY)) {
TxInvocationContext txCtx = (TxInvocationContext) ctx;
txCtx.getTransaction().setRollbackOnly();
}
throw throwable;
}
if (localTransaction != null && command.isSuccessful()) {
localTransaction.addModification(command);
}
return rv;
}