mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
catch CancellationException
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
@@ -49,7 +50,7 @@ public interface Job<T> {
|
||||
|
||||
boolean isDone();
|
||||
|
||||
void waitForCompletion(int millis) throws InterruptedException, ExecutionException, TimeoutException;
|
||||
void waitForCompletion(int millis) throws InterruptedException, ExecutionException, TimeoutException, CancellationException;
|
||||
|
||||
@NotNull
|
||||
Job NULL_JOB = new Job() {
|
||||
|
||||
+6
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -50,6 +50,7 @@ import gnu.trove.THashMap;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
@@ -539,6 +540,7 @@ public abstract class PassExecutorService implements Disposable {
|
||||
private static void saveException(Throwable e, DaemonProgressIndicator indicator) {
|
||||
indicator.putUserDataIfAbsent(THROWABLE_KEY, e);
|
||||
}
|
||||
@TestOnly
|
||||
public static Throwable getSavedException(DaemonProgressIndicator indicator) {
|
||||
return indicator.getUserData(THROWABLE_KEY);
|
||||
}
|
||||
@@ -558,6 +560,9 @@ public abstract class PassExecutorService implements Disposable {
|
||||
catch (InterruptedException e) {
|
||||
return true;
|
||||
}
|
||||
catch (CancellationException e) {
|
||||
return true;
|
||||
}
|
||||
catch (ExecutionException e) {
|
||||
throw e.getCause();
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ public class JobLauncherImpl extends JobLauncher {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void waitForCompletion(int millis) throws InterruptedException, ExecutionException, TimeoutException {
|
||||
public void waitForCompletion(int millis) throws InterruptedException, ExecutionException, TimeoutException, CancellationException {
|
||||
get(millis, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user