public static <T> FlinkCompletableFuture<T> completed(T value) { return new FlinkCompletableFuture<>(value); }
public OneTimeLeaderListenerFuture() { this.future = new FlinkCompletableFuture<>(); }
public static <T> FlinkCompletableFuture<T> completedExceptionally(Throwable t) { return new FlinkCompletableFuture<>(t); } }
PendingStackTraceSample( int sampleId, ExecutionAttemptID[] tasksToCollect) { this.sampleId = sampleId; this.startTime = System.currentTimeMillis(); this.pendingTasks = new HashSet<>(Arrays.asList(tasksToCollect)); this.stackTracesByTask = Maps.newHashMapWithExpectedSize(tasksToCollect.length); this.stackTraceFuture = new FlinkCompletableFuture<>(); }
public StreamRecordQueueEntry(StreamRecord<?> streamRecord) { super(streamRecord); hasTimestamp = streamRecord.hasTimestamp(); timestamp = streamRecord.getTimestamp(); resultFuture = new FlinkCompletableFuture<>(); }
public PendingCheckpoint( JobID jobId, long checkpointId, long checkpointTimestamp, Map<ExecutionAttemptID, ExecutionVertex> verticesToConfirm, CheckpointProperties props, String targetDirectory, Executor executor) { // Sanity check if (props.externalizeCheckpoint() && targetDirectory == null) { throw new NullPointerException("No target directory specified to persist checkpoint to."); } checkArgument(verticesToConfirm.size() > 0, "Checkpoint needs at least one vertex that commits the checkpoint"); this.jobId = checkNotNull(jobId); this.checkpointId = checkpointId; this.checkpointTimestamp = checkpointTimestamp; this.notYetAcknowledgedTasks = checkNotNull(verticesToConfirm); this.props = checkNotNull(props); this.targetDirectory = targetDirectory; this.executor = Preconditions.checkNotNull(executor); this.operatorStates = new HashMap<>(); this.masterState = new ArrayList<>(); this.acknowledgedTasks = new HashSet<>(verticesToConfirm.size()); this.onCompletionPromise = new FlinkCompletableFuture<>(); }
terminationFuture = new FlinkCompletableFuture<>(); failoverStrategy.notifyNewVertices(newExecJobVertices);
private JobLeaderIdListener( JobID jobId, JobLeaderIdActions listenerJobLeaderIdActions, LeaderRetrievalService leaderRetrievalService) throws Exception { this.jobId = Preconditions.checkNotNull(jobId); this.listenerJobLeaderIdActions = Preconditions.checkNotNull(listenerJobLeaderIdActions); this.leaderRetrievalService = Preconditions.checkNotNull(leaderRetrievalService); leaderIdFuture = new FlinkCompletableFuture<>(); activateTimeout(); // start the leader service we're listening to leaderRetrievalService.start(this); }
checkNotNull(rpcEndpoint, "rpc endpoint"); CompletableFuture<Void> terminationFuture = new FlinkCompletableFuture<>(); Props akkaRpcActorProps = Props.create(AkkaRpcActor.class, rpcEndpoint, terminationFuture); ActorRef actorRef;
@Override public <R> Future<R> handleAsync(final BiFunction<? super T, Throwable, ? extends R> biFunction, Executor executor) { Preconditions.checkNotNull(scalaFuture); Preconditions.checkNotNull(biFunction); Preconditions.checkNotNull(executor); final ExecutionContext executionContext = createExecutionContext(executor); final CompletableFuture<R> resultFuture = new FlinkCompletableFuture<>(); scalaFuture.onComplete(new OnComplete<T>() { @Override public void onComplete(Throwable failure, T success) throws Throwable { final R result = biFunction.apply(success, failure); resultFuture.complete(result); } }, executionContext); return resultFuture; }
this.terminationFuture = new FlinkCompletableFuture<>();
Future<SimpleSlot> internalAllocateSlot( ScheduledUnit task, ResourceProfile resources, Iterable<TaskManagerLocation> locationPreferences) { // (1) do we have a slot available already? SlotAndLocality slotFromPool = availableSlots.poll(resources, locationPreferences); if (slotFromPool != null) { SimpleSlot slot = createSimpleSlot(slotFromPool.slot(), slotFromPool.locality()); allocatedSlots.add(slot); return FlinkCompletableFuture.completed(slot); } // the request will be completed by a future final AllocationID allocationID = new AllocationID(); final FlinkCompletableFuture<SimpleSlot> future = new FlinkCompletableFuture<>(); // (2) need to request a slot if (resourceManagerGateway == null) { // no slot available, and no resource manager connection stashRequestWaitingForResourceManager(allocationID, resources, future); } else { // we have a resource manager connection, so let's ask it for more resources requestSlotFromResourceManager(allocationID, future, resources); } return future; }
TaskExecutorGateway gateway = taskExecutorConnection.getTaskExecutorGateway(); final CompletableFuture<Acknowledge> completableFuture = new FlinkCompletableFuture<>(); final AllocationID allocationId = pendingSlotRequest.getAllocationId(); final SlotID slotId = taskManagerSlot.getSlotId();
public RetryingRegistration( Logger log, RpcService rpcService, String targetName, Class<Gateway> targetType, String targetAddress, UUID leaderId, long initialRegistrationTimeout, long maxRegistrationTimeout, long delayOnError, long delayOnRefusedRegistration) { checkArgument(initialRegistrationTimeout > 0, "initial registration timeout must be greater than zero"); checkArgument(maxRegistrationTimeout > 0, "maximum registration timeout must be greater than zero"); checkArgument(delayOnError >= 0, "delay on error must be non-negative"); checkArgument(delayOnRefusedRegistration >= 0, "delay on refused registration must be non-negative"); this.log = checkNotNull(log); this.rpcService = checkNotNull(rpcService); this.targetName = checkNotNull(targetName); this.targetType = checkNotNull(targetType); this.targetAddress = checkNotNull(targetAddress); this.leaderId = checkNotNull(leaderId); this.initialRegistrationTimeout = initialRegistrationTimeout; this.maxRegistrationTimeout = maxRegistrationTimeout; this.delayOnError = delayOnError; this.delayOnRefusedRegistration = delayOnRefusedRegistration; this.completionFuture = new FlinkCompletableFuture<>(); }
CompletableFuture<SimpleSlot> future = new FlinkCompletableFuture<>(); this.taskQueue.add(new QueuedTask(task, future)); return future;