fix: recognizing CancellationException as crash

This commit is contained in:
huanghongxun
2020-02-04 22:49:49 +08:00
parent a162828f0a
commit 1b466eb33f

View File

@@ -108,6 +108,8 @@ public final class TaskExecutor {
throw new IllegalStateException("Cannot cancel a not started TaskExecutor"); throw new IllegalStateException("Cannot cancel a not started TaskExecutor");
} }
Logging.LOG.log(Level.INFO, "Cancelling task " + firstTask);
cancelled.set(true); cancelled.set(true);
future.cancel(true); future.cancel(true);
} }
@@ -132,9 +134,6 @@ public final class TaskExecutor {
.thenApplyAsync(unused -> (Exception) null) .thenApplyAsync(unused -> (Exception) null)
.exceptionally(throwable -> { .exceptionally(throwable -> {
Throwable resolved = resolveException(throwable); Throwable resolved = resolveException(throwable);
if (resolved instanceof CancellationException) {
throw (CancellationException)resolved;
}
if (resolved instanceof Exception) { if (resolved instanceof Exception) {
return (Exception) resolved; return (Exception) resolved;
} else { } else {