mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
BgTaskUtil.executeOnPooledThread: catch and ignore PCE
It is expected for the task to throw the PCE (e.g. on dispose). It fixes EA-107241 where the PCE is thrown during future.get().
This commit is contained in:
+8
-1
@@ -194,7 +194,14 @@ public class BackgroundTaskUtil {
|
||||
boolean onPooledThread) {
|
||||
ProgressIndicator indicator = new EmptyProgressIndicator(modalityState);
|
||||
indicator.start();
|
||||
Runnable toRun = () -> ProgressManager.getInstance().runProcess(task, indicator);
|
||||
Runnable toRun = () -> {
|
||||
try {
|
||||
ProgressManager.getInstance().runProcess(task, indicator);
|
||||
}
|
||||
catch (ProcessCanceledException pce) {
|
||||
// ignore: expected cancellation
|
||||
}
|
||||
};
|
||||
|
||||
if (onPooledThread) {
|
||||
CompletableFuture<?> future = CompletableFuture.runAsync(toRun, AppExecutorUtil.getAppExecutorService());
|
||||
|
||||
Reference in New Issue
Block a user