@Override public Will<A> replaceFailed(final ListenableFuture<A> future) { return replaceFailed(new FutureFallback<A>() { @Override public ListenableFuture<A> create(Throwable t) throws Exception { return future; } }); }
public <V> AsyncCommand<V> build(final Callable<V> callable, final FutureFallback<V> fallback) { final Function<Callable<V>, Callable<V>> f = callableBuilder.build(); return new AsyncCommand<V>() { @Override public ListenableFuture<V> execute() { Callable<V> c = f.apply(callable); ListenableFutureTask<V> t = ListenableFutureTask.create(c); executor.execute(t); return withFallback(t, fallback); } }; }
@Override public Will<A> replaceFailed(FutureFallback<? extends A> fallback) { return new Of<A>(Futures.withFallback(delegate(), fallback)); }
@Override public FluentCheckedFuture<V, X> withFallback(FutureFallback<V> fallback) { return (FluentCheckedFuture<V, X>) super.withFallback(fallback); }
@Override public FluentCheckedFuture<V, X> withFallback(Executor executor, FutureFallback<V> fallback) { return (FluentCheckedFuture<V, X>) super.withFallback(executor, fallback); }
/** * Replaces future provided by fallback in case if current Will fails * <b>PAY ATTENTION - this method creates new Will instance</b> * * @param fallback New Future Factory * @return <b>NEW</b> Will */ Will<T> replaceFailed(FutureFallback<? extends T> fallback);
FluentFuture<V> withFallback(FutureFallback<V> fallback);
FluentFuture<V> withFallback(Executor executor, FutureFallback<V> fallback);