@Override
    public CompletableFuture<?> cancel() {
        final List<CompletableFuture<?>> cancelResultFutures =
                new ArrayList<>(currentExecutions.size());
        for (Execution execution : currentExecutions.values()) {
            execution.cancel();
            cancelResultFutures.add(execution.getReleaseFuture());
        }
        return FutureUtils.combineAll(cancelResultFutures);
    }
@Test
    void testCancel() throws Exception {
        final SpeculativeExecutionVertex ev = createSpeculativeExecutionVertex();
        final Execution e1 = ev.getCurrentExecutionAttempt();
        final Execution e2 = ev.createNewSpeculativeExecution(System.currentTimeMillis());

        ev.cancel();
        assertThat(e1.getState()).isSameAs(ExecutionState.CANCELED);
        assertThat(e2.getState()).isSameAs(ExecutionState.CANCELED);
    }