diff --git a/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/ExecutionContextImpl.java b/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/ExecutionContextImpl.java index 87eea726..2e1bf10a 100644 --- a/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/ExecutionContextImpl.java +++ b/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/ExecutionContextImpl.java @@ -22,22 +22,22 @@ import org.eclipse.microprofile.faulttolerance.ExecutionContext; final class ExecutionContextImpl implements ExecutionContext { - private final InvocationContext interceptionContext; + private final InvocationContext invocationContext; private final Throwable failure; - ExecutionContextImpl(InvocationContext interceptionContext, Throwable failure) { - this.interceptionContext = interceptionContext; + ExecutionContextImpl(InvocationContext invocationContext, Throwable failure) { + this.invocationContext = invocationContext; this.failure = failure; } @Override public Method getMethod() { - return interceptionContext.getMethod(); + return invocationContext.getMethod(); } @Override public Object[] getParameters() { - return interceptionContext.getParameters(); + return invocationContext.getParameters(); } @Override diff --git a/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/FaultToleranceInterceptor.java b/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/FaultToleranceInterceptor.java index 653b7da2..d8de4977 100644 --- a/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/FaultToleranceInterceptor.java +++ b/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/FaultToleranceInterceptor.java @@ -187,22 +187,22 @@ public FaultToleranceInterceptor( } @AroundInvoke - public Object intercept(InvocationContext interceptionContext) throws Throwable { - Method method = interceptionContext.getMethod(); + public Object intercept(InvocationContext invocationContext) throws Throwable { + Method method = invocationContext.getMethod(); Class beanClass = interceptedBean != null ? interceptedBean.getBeanClass() : method.getDeclaringClass(); - InterceptionPoint point = new InterceptionPoint(beanClass, interceptionContext.getMethod()); + InterceptionPoint point = new InterceptionPoint(beanClass, invocationContext.getMethod()); FaultToleranceOperation operation = operationProvider.get(beanClass, method); if (operation.hasApplyFaultTolerance()) { - return applyFaultToleranceFlow(operation, interceptionContext); + return applyFaultToleranceFlow(operation, invocationContext); } else if (operation.hasApplyGuard()) { - return applyGuardFlow(operation, interceptionContext, point); + return applyGuardFlow(operation, invocationContext, point); } else if (specCompatibility.isOperationTrulyAsynchronous(operation)) { - return asyncFlow(operation, interceptionContext, point); + return asyncFlow(operation, invocationContext, point); } else if (specCompatibility.isOperationPseudoAsynchronous(operation)) { - return futureFlow(operation, interceptionContext, point); + return futureFlow(operation, invocationContext, point); } else { - return syncFlow(operation, interceptionContext, point); + return syncFlow(operation, invocationContext, point); } } @@ -211,7 +211,7 @@ public Object intercept(InvocationContext interceptionContext) throws Throwable // // in synchronous scenario, V = T // in asynchronous scenario, T is an async type that eventually produces V - private T applyFaultToleranceFlow(FaultToleranceOperation operation, InvocationContext interceptionContext) + private T applyFaultToleranceFlow(FaultToleranceOperation operation, InvocationContext invocationContext) throws Exception { String identifier = operation.getApplyFaultTolerance().value(); Instance> instance = configuredFaultTolerance.select(Identifier.Literal.of(identifier)); @@ -233,7 +233,7 @@ private T applyFaultToleranceFlow(FaultToleranceOperation operation, Invo AsyncSupport fromConfigured = asyncType == null ? null : AsyncSupportRegistry.get(new Class[0], asyncType); if (forOperation == null && fromConfigured == null) { - return (T) lazyFaultTolerance.call(interceptionContext::proceed, meteredOperationName); + return (T) lazyFaultTolerance.call(invocationContext::proceed, meteredOperationName); } else if (forOperation == null) { throw new FaultToleranceException("Configured fault tolerance '" + identifier + "' expects the operation to " + fromConfigured.mustDescription() @@ -247,7 +247,7 @@ private T applyFaultToleranceFlow(FaultToleranceOperation operation, Invo + "' expects the operation to " + fromConfigured.mustDescription() + ", but it " + forOperation.doesDescription() + ": " + operation); } else { - return (T) lazyFaultTolerance.call(interceptionContext::proceed, meteredOperationName); + return (T) lazyFaultTolerance.call(invocationContext::proceed, meteredOperationName); } } @@ -256,7 +256,7 @@ private T applyFaultToleranceFlow(FaultToleranceOperation operation, Invo // // in synchronous scenario, V = T // in asynchronous scenario, T is an async type that eventually produces V - private T applyGuardFlow(FaultToleranceOperation operation, InvocationContext interceptionContext, + private T applyGuardFlow(FaultToleranceOperation operation, InvocationContext invocationContext, InterceptionPoint point) throws Exception { String identifier = operation.getApplyGuard().value(); Instance guardInstance = configuredGuard.select(Identifier.Literal.of(identifier)); @@ -287,7 +287,7 @@ private T applyGuardFlow(FaultToleranceOperation operation, InvocationCon MeteredOperationName meteredOperationName = new MeteredOperationName(operation.getName()); Consumer> contextModifier = ctx -> { - ctx.set(InvocationContext.class, interceptionContext); + ctx.set(InvocationContext.class, invocationContext); if (fallbackFunction != null) { ctx.set(FallbackFunction.class, fallbackFunction); @@ -309,7 +309,7 @@ private T applyGuardFlow(FaultToleranceOperation operation, InvocationCon } GuardImpl guardImpl = ((LazyGuard) guard).instance(); - return guardImpl.guard(() -> (T) interceptionContext.proceed(), operation.getReturnType(), contextModifier); + return guardImpl.guard(() -> (T) invocationContext.proceed(), operation.getReturnType(), contextModifier); } else /* typedGuardInstance.isResolvable() */ { TypedGuard guard = typedGuardInstance.get(); if (!(guard instanceof LazyTypedGuard)) { @@ -318,7 +318,7 @@ private T applyGuardFlow(FaultToleranceOperation operation, InvocationCon } TypedGuardImpl guardImpl = ((LazyTypedGuard) guard).instance(); - return guardImpl.guard(() -> (T) interceptionContext.proceed(), contextModifier); + return guardImpl.guard(() -> (T) invocationContext.proceed(), contextModifier); } } diff --git a/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/internal/BeforeRetryMethod.java b/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/internal/BeforeRetryMethod.java index 18e27076..ad778bca 100644 --- a/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/internal/BeforeRetryMethod.java +++ b/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/internal/BeforeRetryMethod.java @@ -20,15 +20,15 @@ public final class BeforeRetryMethod { } public Invoker createInvoker(FailureContext ctx) throws ReflectiveOperationException { - InvocationContext interceptionContext = ctx.context.get(InvocationContext.class); - Object[] arguments = interceptionContext.getParameters(); + InvocationContext invocationContext = ctx.context.get(InvocationContext.class); + Object[] arguments = invocationContext.getParameters(); if (arguments == null) { arguments = EMPTY_ARRAY; } return method.isDefault() - ? new SpecialMethodInvoker<>(method, interceptionContext.getTarget(), arguments) - : new NormalMethodInvoker<>(method, interceptionContext.getTarget(), arguments); + ? new SpecialMethodInvoker<>(method, invocationContext.getTarget(), arguments) + : new NormalMethodInvoker<>(method, invocationContext.getTarget(), arguments); } // --- diff --git a/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/internal/FallbackMethod.java b/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/internal/FallbackMethod.java index e3903efc..b34e6fa1 100644 --- a/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/internal/FallbackMethod.java +++ b/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/internal/FallbackMethod.java @@ -32,16 +32,16 @@ private FallbackMethod(Method method, int exceptionParameterPosition) { // --- public Invoker createInvoker(FailureContext ctx) throws ReflectiveOperationException { - InvocationContext interceptionContext = ctx.context.get(InvocationContext.class); - Object[] arguments = interceptionContext.getParameters(); + InvocationContext invocationContext = ctx.context.get(InvocationContext.class); + Object[] arguments = invocationContext.getParameters(); if (arguments == null) { arguments = EMPTY_ARRAY; } arguments = adjustArguments(arguments, ctx.failure); return method.isDefault() - ? new SpecialMethodInvoker<>(method, interceptionContext.getTarget(), arguments) - : new NormalMethodInvoker<>(method, interceptionContext.getTarget(), arguments); + ? new SpecialMethodInvoker<>(method, invocationContext.getTarget(), arguments) + : new NormalMethodInvoker<>(method, invocationContext.getTarget(), arguments); } private Object[] adjustArguments(Object[] arguments, Throwable exception) { diff --git a/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/internal/InterceptionInvoker.java b/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/internal/InterceptionInvoker.java index 70f2a1e5..64aaffe5 100644 --- a/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/internal/InterceptionInvoker.java +++ b/implementation/fault-tolerance/src/main/java/io/smallrye/faulttolerance/internal/InterceptionInvoker.java @@ -7,34 +7,34 @@ import io.smallrye.faulttolerance.core.invocation.Invoker; public class InterceptionInvoker implements Invoker { - private final InvocationContext interceptionContext; + private final InvocationContext invocationContext; - public InterceptionInvoker(InvocationContext interceptionContext) { - this.interceptionContext = interceptionContext; + public InterceptionInvoker(InvocationContext invocationContext) { + this.invocationContext = invocationContext; } @Override public int parametersCount() { - return interceptionContext.getParameters().length; + return invocationContext.getParameters().length; } @Override public T getArgument(int index, Class parameterType) { - return parameterType.cast(interceptionContext.getParameters()[index]); + return parameterType.cast(invocationContext.getParameters()[index]); } @Override public T replaceArgument(int index, Class parameterType, Function transformation) { - Object[] arguments = interceptionContext.getParameters(); + Object[] arguments = invocationContext.getParameters(); T oldArg = parameterType.cast(arguments[index]); T newArg = transformation.apply(oldArg); arguments[index] = newArg; - interceptionContext.setParameters(arguments); + invocationContext.setParameters(arguments); return oldArg; } @Override public V proceed() throws Exception { - return (V) interceptionContext.proceed(); + return (V) invocationContext.proceed(); } }