private Object handleCrudMethod(final InvocationContext ctx, final WriteCommand command) throws Throwable {
// FIRST pass this call up the chain. Only if it succeeds (no exceptions) locally do we attempt to replicate.
final Object returnValue = invokeNextInterceptor(ctx, command);
if (!isLocalModeForced(ctx) && command.isSuccessful() && ctx.isOriginLocal() && !ctx.isInTxScope()) {
if (ctx.isUseFutureReturnType()) {
return new AsyncReturnValue(rpcManager.broadcastRpcCommandInFuture(command), returnValue);
} else {
rpcManager.broadcastRpcCommand(command, isSynchronous(ctx));
}
}
return returnValue;