@Override public void handleError(Exception exception) { future.completeExceptionally(exception); } }
@Override public boolean cancel(boolean mayInterruptIfRunning) { return completeExceptionally(new CancellationException("Future has been canceled.")); }
private void slotRequestToResourceManagerFailed(AllocationID allocationID, Throwable failure) { PendingRequest request = pendingRequests.remove(allocationID); if (request != null) { request.future().completeExceptionally(new NoResourceAvailableException( "No pooled slot available and request to ResourceManager for new slot failed", failure)); } else { if (LOG.isDebugEnabled()) { LOG.debug("Unregistered slot request {} failed.", allocationID, failure); } } }
/** * Aborts the pending checkpoint due to an error. * @param cause The error's exception. */ public void abortError(Throwable cause) { try { Exception failure = new Exception("Checkpoint failed: " + cause.getMessage(), cause); onCompletionPromise.completeExceptionally(failure); reportFailedCheckpoint(failure); } finally { dispose(true); } }
public void abortDeclined() { try { Exception cause = new Exception("Checkpoint was declined (tasks not ready)"); onCompletionPromise.completeExceptionally(cause); reportFailedCheckpoint(cause); } finally { dispose(true); } }
/** * Aborts a checkpoint because it expired (took too long). */ public void abortExpired() { try { Exception cause = new Exception("Checkpoint expired before completing"); onCompletionPromise.completeExceptionally(cause); reportFailedCheckpoint(cause); } finally { dispose(true); } }
private void checkTimeoutSlotAllocation(AllocationID allocationID) { PendingRequest request = pendingRequests.remove(allocationID); if (request != null && !request.future().isDone()) { request.future().completeExceptionally(new TimeoutException("Slot allocation request timed out")); } }
/** * Aborts the pending checkpoint because a newer completed checkpoint subsumed it. */ public void abortSubsumed() { try { Exception cause = new Exception("Checkpoints has been subsumed"); onCompletionPromise.completeExceptionally(cause); reportFailedCheckpoint(cause); if (props.forceCheckpoint()) { throw new IllegalStateException("Bug: forced checkpoints must never be subsumed"); } } finally { dispose(true); } }
private void checkTimeoutRequestWaitingForResourceManager(AllocationID allocationID) { PendingRequest request = waitingForResourceManager.remove(allocationID); if (request != null && !request.future().isDone()) { request.future().completeExceptionally(new NoResourceAvailableException( "No slot available and no connection to Resource Manager established.")); } }
pendingRequest.future().completeExceptionally(cause);
public CompletedCheckpoint finalizeCheckpointNonExternalized() { synchronized (lock) { checkState(isFullyAcknowledged(), "Pending checkpoint has not been fully acknowledged yet."); // make sure we fulfill the promise with an exception if something fails try { // finalize without external metadata return finalizeInternal(null, null); } catch (Throwable t) { onCompletionPromise.completeExceptionally(t); ExceptionUtils.rethrow(t); return null; // silence the compiler } } }
onCompletionPromise.completeExceptionally(t); ExceptionUtils.rethrowIOException(t); return null; // silence the compiler