/** * Wraps the given {@code delegate} and waits for the result in the Future to become available, with given * {@code timeout} and {@code timeUnit}. * * @param delegate The delegate to invoke, returning a Future * @param timeout The amount of time to wait for the result to become available * @param timeUnit The unit of time to wait * @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> wrapToReturnWithFixedTimeout(InvocationHandler<CompletableFuture<R>> delegate, long timeout, TimeUnit timeUnit) { return new WaitForResultWithFixedTimeout<>(delegate, timeout, timeUnit); }
/** * Wraps the given {@code delegate} and waits for the result in the Future to become available, with given * {@code timeout} and {@code timeUnit}. * * @param delegate The delegate to invoke, returning a Future * @param timeout The amount of time to wait for the result to become available * @param timeUnit The unit of time to wait * @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> wrapToReturnWithFixedTimeout(InvocationHandler<CompletableFuture<R>> delegate, long timeout, TimeUnit timeUnit) { return new WaitForResultWithFixedTimeout<>(delegate, timeout, timeUnit); }
/** * Wraps the given {@code delegate} and waits for the result in the Future to become available, with given * {@code timeout} and {@code timeUnit}. * * @param delegate The delegate to invoke, returning a Future * @param timeout The amount of time to wait for the result to become available * @param timeUnit The unit of time to wait * @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> wrapToReturnWithFixedTimeout(InvocationHandler<CompletableFuture<R>> delegate, long timeout, TimeUnit timeUnit) { return new WaitForResultWithFixedTimeout<>(delegate, timeout, timeUnit); }