From 504529b470857bec392cf58cf7c6b16dd6df0521 Mon Sep 17 00:00:00 2001 From: Ulf Adams Date: Wed, 23 Sep 2015 15:18:01 +0000 Subject: Move callUninterruptibly to a helper class in lib.concurrent. -- MOS_MIGRATED_REVID=103747062 --- .../build/lib/skyframe/SkyframeExecutor.java | 28 ++-------------------- 1 file changed, 2 insertions(+), 26 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java') 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. - * - *

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. - * - *

This is almost identical to {@code Uninterruptibles#getUninterruptibly}. - */ - protected static final T callUninterruptibly(Callable 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; -- cgit v1.2.3