@Override public boolean isDone() { return this.completableFuture.isDone(); }
@Override public boolean isDone() { return super.isDone(); }
@Override public boolean isDone() { return super.isDone(); }
@Override public boolean isDone() { return this.completableFuture.isDone(); }
@Override public boolean isExecuted() { val future = futureRef.get(); return future != null && future.isDone(); }
/** * True if the stream element queue entry has been completed; otherwise false. * * @return True if the stream element queue entry has been completed; otherwise false. */ public boolean isDone() { return getFuture().isDone(); }
public Result getRpcResult() { try { if (resultFuture.isDone()) { return resultFuture.get(); } } catch (Exception e) { // This should never happen; logger.error("Got exception when trying to fetch the underlying result from AsyncRpcResult.", e); } return new RpcResult(); }
public Result getRpcResult() { try { if (resultFuture.isDone()) { return resultFuture.get(); } } catch (Exception e) { // This should never happen; logger.error("Got exception when trying to fetch the underlying result from AsyncRpcResult.", e); } return new RpcResult(); }
/** Returns if the future has successfully completed. */ static boolean isReady(@Nullable CompletableFuture<?> future) { return (future != null) && future.isDone() && !future.isCompletedExceptionally() && (future.join() != null); }
@Override public ListenableFuture<?> isBlocked() { CompletableFuture<?> pageSourceBlocked = pageSource.isBlocked(); return pageSourceBlocked.isDone() ? NOT_BLOCKED : toListenableFuture(pageSourceBlocked); }
public static boolean isSuccessFuture(CompletableFuture future) { return future.isDone() && !future.isCompletedExceptionally() && !future.isCancelled(); }
@Override public ListenableFuture<?> isBlocked() { if (!blocked.isDone()) { return blocked; } if (source != null) { CompletableFuture<?> pageSourceBlocked = source.isBlocked(); return pageSourceBlocked.isDone() ? NOT_BLOCKED : toListenableFuture(pageSourceBlocked); } return NOT_BLOCKED; }
@Override public ListenableFuture<?> isBlocked() { if (!blocked.isDone()) { return blocked; } if (pageSource != null) { CompletableFuture<?> pageSourceBlocked = pageSource.isBlocked(); return pageSourceBlocked.isDone() ? NOT_BLOCKED : toListenableFuture(pageSourceBlocked); } return NOT_BLOCKED; }
/** * Initializes the record writer thread with this many numbers to send. * * <p>If the thread was already started, if may now continue. * * @param records * number of records to send */ public synchronized void setRecordsToSend(long records) { checkState(!recordsToSend.isDone()); recordsToSend.complete(records); }
private synchronized List<ConnectorSplit> getBatch(int maxSize) { // take up to maxSize elements from the queue List<ConnectorSplit> elements = new ArrayList<>(maxSize); queue.drainTo(elements, maxSize); // if the queue is empty and the current future is finished, create a new one so // a new readers can be notified when the queue has elements to read if (queue.isEmpty() && !closed) { if (notEmptyFuture.isDone()) { notEmptyFuture = new CompletableFuture<>(); } } return ImmutableList.copyOf(elements); }
protected String toStringOf(CompletableFuture<?> future) { String className = future.getClass().getSimpleName(); if (!future.isDone()) return concat(className, "[Incomplete]"); try { Object joinResult = future.join(); // avoid stack overflow error if future join on itself or another future that cycles back to the first Object joinResultRepresentation = joinResult instanceof CompletableFuture ? joinResult : toStringOf(joinResult); return concat(className, "[Completed: ", joinResultRepresentation, "]"); } catch (CompletionException e) { return concat(className, "[Failed: ", toStringOf(e.getCause()), "]", String.format("%n%s", getStackTrace(e))); } catch (CancellationException e) { return concat(className, "[Cancelled]"); } }
private Tuple2<JobID, Integer> callModify(String[] args) throws Exception { final CompletableFuture<Tuple2<JobID, Integer>> rescaleJobFuture = new CompletableFuture<>(); final TestingClusterClient clusterClient = new TestingClusterClient(rescaleJobFuture, getConfiguration()); final MockedCliFrontend cliFrontend = new MockedCliFrontend(clusterClient); cliFrontend.modify(args); assertThat(rescaleJobFuture.isDone(), Matchers.is(true)); return rescaleJobFuture.get(); }
@CheckNoWriter @Test(dataProvider = "caches") @CacheSpec(loader = Loader.NULL) public void getFunc_absent_null(AsyncCache<Integer, Integer> cache, CacheContext context) { Integer key = context.absentKey(); CompletableFuture<Integer> valueFuture = cache.get(key, k -> null); assertThat(context, both(hasMissCount(1)).and(hasHitCount(0))); assertThat(context, both(hasLoadSuccessCount(0)).and(hasLoadFailureCount(1))); assertThat(valueFuture.isDone(), is(true)); assertThat(cache.getIfPresent(key), is(nullValue())); }