fix: recognizing CancellationException as crash
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user