Java 类com.google.common.util.concurrent.FutureFallback 实例源码

项目:benayn    文件:Wills.java   
@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;
        }
    });
}
项目:AsyncUtils    文件:CommandBuilder.java   
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);
    }
  };
}
项目:benayn    文件:Wills.java   
@Override public Will<A> replaceFailed(FutureFallback<? extends A> fallback) {
    return new Of<A>(Futures.withFallback(delegate(), fallback));
}
项目:fluent-futures    文件:CheckedDecorator.java   
@Override
public FluentCheckedFuture<V, X> withFallback(FutureFallback<V> fallback) {
    return (FluentCheckedFuture<V, X>) super.withFallback(fallback);
}
项目:fluent-futures    文件:CheckedDecorator.java   
@Override
public FluentCheckedFuture<V, X> withFallback(Executor executor, FutureFallback<V> fallback) {
    return (FluentCheckedFuture<V, X>) super.withFallback(executor, fallback);
}
项目:benayn    文件:Wills.java   
/**
 * 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);
项目:fluent-futures    文件:FluentFuture.java   
FluentFuture<V> withFallback(FutureFallback<V> fallback);
项目:fluent-futures    文件:FluentFuture.java   
FluentFuture<V> withFallback(Executor executor, FutureFallback<V> fallback);