/** * Wraps the given {@code delegate} and waits for the result in the Future to become available using given * indices to resolve the parameters that provide the timeout to use. * * @param delegate The delegate to invoke, returning a Future * @param timeoutIndex The index of the argument providing the timeout * @param timeUnitIndex The index of the argument providing the time unit * @param <R> The result of the command handler * @return the result of the Future, either a return value or an exception */ protected <R> InvocationHandler<R> wrapToReturnWithTimeoutInArguments( final InvocationHandler<CompletableFuture<R>> delegate, int timeoutIndex, int timeUnitIndex) { return new WaitForResultWithTimeoutInArguments<>(delegate, timeoutIndex, timeUnitIndex); }
/** * Wraps the given {@code delegate} and waits for the result in the Future to become available using given * indices to resolve the parameters that provide the timeout to use. * * @param delegate The delegate to invoke, returning a Future * @param timeoutIndex The index of the argument providing the timeout * @param timeUnitIndex The index of the argument providing the time unit * @param <R> The result of the command handler * @return the result of the Future, either a return value or an exception */ protected <R> InvocationHandler<R> wrapToReturnWithTimeoutInArguments( final InvocationHandler<CompletableFuture<R>> delegate, int timeoutIndex, int timeUnitIndex) { return new WaitForResultWithTimeoutInArguments<>(delegate, timeoutIndex, timeUnitIndex); }
/** * Wraps the given {@code delegate} and waits for the result in the Future to become available using given * indices to resolve the parameters that provide the timeout to use. * * @param delegate The delegate to invoke, returning a Future * @param timeoutIndex The index of the argument providing the timeout * @param timeUnitIndex The index of the argument providing the time unit * @param <R> The result of the command handler * @return the result of the Future, either a return value or an exception */ protected <R> InvocationHandler<R> wrapToReturnWithTimeoutInArguments( final InvocationHandler<CompletableFuture<R>> delegate, int timeoutIndex, int timeUnitIndex) { return new WaitForResultWithTimeoutInArguments<>(delegate, timeoutIndex, timeUnitIndex); }