/** * Atomically sets the executed vertex, if no vertex has been assigned to this slot so far. * * @param executedVertex The vertex to assign to this slot. * @return True, if the vertex was assigned, false, otherwise. */ public boolean setExecutedVertex(Execution executedVertex) { if (executedVertex == null) { throw new NullPointerException(); } // check that we can actually run in this slot if (isCanceled()) { return false; } // atomically assign the vertex if (!VERTEX_UPDATER.compareAndSet(this, null, executedVertex)) { return false; } // we need to do a double check that we were not cancelled in the meantime if (isCanceled()) { this.executedTask = null; return false; } return true; }
/** * Atomically sets the executed vertex, if no vertex has been assigned to this slot so far. * * @param payload The vertex to assign to this slot. * @return True, if the vertex was assigned, false, otherwise. */ @Override public boolean tryAssignPayload(Payload payload) { Preconditions.checkNotNull(payload); // check that we can actually run in this slot if (isCanceled()) { return false; } // atomically assign the vertex if (!PAYLOAD_UPDATER.compareAndSet(this, null, payload)) { return false; } // we need to do a double check that we were not cancelled in the meantime if (isCanceled()) { this.payload = null; return false; } return true; }
/** * Atomically sets the executed vertex, if no vertex has been assigned to this slot so far. * * @param payload The vertex to assign to this slot. * @return True, if the vertex was assigned, false, otherwise. */ @Override public boolean tryAssignPayload(Payload payload) { Preconditions.checkNotNull(payload); // check that we can actually run in this slot if (isCanceled()) { return false; } // atomically assign the vertex if (!PAYLOAD_UPDATER.compareAndSet(this, null, payload)) { return false; } // we need to do a double check that we were not cancelled in the meantime if (isCanceled()) { this.payload = null; return false; } return true; }
/** * Atomically sets the executed vertex, if no vertex has been assigned to this slot so far. * * @param payload The vertex to assign to this slot. * @return True, if the vertex was assigned, false, otherwise. */ @Override public boolean tryAssignPayload(Payload payload) { Preconditions.checkNotNull(payload); // check that we can actually run in this slot if (isCanceled()) { return false; } // atomically assign the vertex if (!PAYLOAD_UPDATER.compareAndSet(this, null, payload)) { return false; } // we need to do a double check that we were not cancelled in the meantime if (isCanceled()) { this.payload = null; return false; } return true; }
@Override public CompletableFuture<?> releaseSlot(@Nullable Throwable cause) { if (!isCanceled()) { final CompletableFuture<?> terminationFuture;
@Override public CompletableFuture<?> releaseSlot(@Nullable Throwable cause) { if (!isCanceled()) { final CompletableFuture<?> terminationFuture;
@Override public CompletableFuture<?> releaseSlot(@Nullable Throwable cause) { if (!isCanceled()) { final CompletableFuture<?> terminationFuture;
@Override public void releaseSlot() { if (!isCanceled()) { // kill all tasks currently running in this slot Execution exec = this.executedTask; if (exec != null && !exec.isFinished()) { exec.fail(new Exception("TaskManager was lost/killed: " + getTaskManagerLocation())); } // release directly (if we are directly allocated), // otherwise release through the parent shared slot if (getParent() == null) { // we have to give back the slot to the owning instance if (markCancelled()) { getOwner().returnAllocatedSlot(this); } } else { // we have to ask our parent to dispose us getParent().releaseChild(this); } } }