This commit is contained in:
huanghongxun
2020-02-05 14:36:44 +08:00
parent 5a8446524a
commit bdee33456b
2 changed files with 78 additions and 3 deletions

View File

@@ -87,7 +87,12 @@ public final class AsyncTaskExecutor extends TaskExecutor {
@Override
public synchronized void cancel() {
// AsyncTaskExecutor does not support cancellation.
if (future == null) {
throw new IllegalStateException("Cannot cancel a not started TaskExecutor");
}
cancelled.set(true);
future.cancel(true);
}
private CompletableFuture<Exception> executeTasks(Collection<Task<?>> tasks) {