@Override public void collect(Throwable error) { resultFuture.completeExceptionally(error); } }
void discard(Throwable cause) { if (!isDiscarded) { pendingTasks.clear(); stackTracesByTask.clear(); stackTraceFuture.completeExceptionally(new RuntimeException("Discarded", cause)); isDiscarded = true; } }
@Override public Void apply(Acknowledge acknowledge, Throwable throwable) { if (acknowledge != null) { completableFuture.complete(acknowledge); } else { completableFuture.completeExceptionally(throwable); } return null; } });
public void stop() throws Exception { running = false; leaderRetrievalService.stop(); cancelTimeout(); leaderIdFuture.completeExceptionally(new Exception("Job leader id service has been stopped.")); }
/** * Rejects the pending slot request by failing the request future with a * {@link SlotAllocationException}. * * @param pendingSlotRequest to reject * @param cause of the rejection */ private void rejectPendingSlotRequest(PendingSlotRequest pendingSlotRequest, Exception cause) { CompletableFuture<Acknowledge> request = pendingSlotRequest.getRequestFuture(); if (null != request) { request.completeExceptionally(new SlotAllocationException(cause)); } else { LOG.debug("Cannot reject pending slot request {}, since no request has been sent.", pendingSlotRequest.getAllocationId()); } }
completionFuture.completeExceptionally(t);
completionFuture.completeExceptionally(t);