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

项目:bazel    文件:SkyQueryEnvironment.java   
private <R> ListenableFuture<R> safeSubmitAsync(AsyncCallable<R> callable) {
  try {
    return Futures.submitAsync(callable, executor);
  } catch (RejectedExecutionException e) {
    return Futures.immediateCancelledFuture();
  }
}
项目:bazel    文件:SkyQueryEnvironment.java   
@ThreadSafe
@Override
public QueryTaskFuture<Void> eval(
    final QueryExpression expr,
    final VariableContext<Target> context,
    final Callback<Target> callback) {
  // TODO(bazel-team): As in here, use concurrency for the async #eval of other QueryEnvironment
  // implementations.
  AsyncCallable<Void> task =
      () -> (QueryTaskFutureImpl<Void>) expr.eval(SkyQueryEnvironment.this, context, callback);
  return QueryTaskFutureImpl.ofDelegate(safeSubmitAsync(task));
}
项目:error-prone    文件:AsyncCallableReturnsNull.java   
public AsyncCallableReturnsNull() {
  super(AsyncCallable.class);
}