private <R> ListenableFuture<R> safeSubmitAsync(AsyncCallable<R> callable) { try { return Futures.submitAsync(callable, executor); } catch (RejectedExecutionException e) { return Futures.immediateCancelledFuture(); } }
@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)); }
public AsyncCallableReturnsNull() { super(AsyncCallable.class); }