diff options
author | Ulf Adams <ulfjack@google.com> | 2015-09-23 15:18:01 +0000 |
---|---|---|
committer | Philipp Wollermann <philwo@google.com> | 2015-09-24 14:16:42 +0000 |
commit | 504529b470857bec392cf58cf7c6b16dd6df0521 (patch) | |
tree | 7ba665931a2f051e108295731e43adbb9c85573b /src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java | |
parent | 95f624f4170f170854af185dfc336bb80fa9e470 (diff) |
Move callUninterruptibly to a helper class in lib.concurrent.
--
MOS_MIGRATED_REVID=103747062
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java index bc624d1837..8e74239d05 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java @@ -13,6 +13,8 @@ // limitations under the License. package com.google.devtools.build.lib.skyframe; +import static com.google.devtools.build.lib.concurrent.Uninterruptibles.callUninterruptibly; + import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; import com.google.common.base.Preconditions; @@ -1533,32 +1535,6 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { } } - /** - * Calls the given callable uninterruptibly. - * - * <p>If the callable throws {@link InterruptedException}, calls it again, until the callable - * returns a result. Sets the {@code currentThread().interrupted()} bit if the callable threw - * {@link InterruptedException} at least once. - * - * <p>This is almost identical to {@code Uninterruptibles#getUninterruptibly}. - */ - protected static final <T> T callUninterruptibly(Callable<T> callable) throws Exception { - boolean interrupted = false; - try { - while (true) { - try { - return callable.call(); - } catch (InterruptedException e) { - interrupted = true; - } - } - } finally { - if (interrupted) { - Thread.currentThread().interrupt(); - } - } - } - @VisibleForTesting public MemoizingEvaluator getEvaluatorForTesting() { return memoizingEvaluator; |