diff options
Diffstat (limited to 'android/guava/src/com/google/common/util/concurrent/AbstractService.java')
-rw-r--r-- | android/guava/src/com/google/common/util/concurrent/AbstractService.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/android/guava/src/com/google/common/util/concurrent/AbstractService.java b/android/guava/src/com/google/common/util/concurrent/AbstractService.java index 1cf31bf91..6ead7b4de 100644 --- a/android/guava/src/com/google/common/util/concurrent/AbstractService.java +++ b/android/guava/src/com/google/common/util/concurrent/AbstractService.java @@ -17,6 +17,7 @@ package com.google.common.util.concurrent; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; +import static com.google.common.util.concurrent.Platform.restoreInterruptIfIsInterruptedException; import static com.google.common.util.concurrent.Service.State.FAILED; import static com.google.common.util.concurrent.Service.State.NEW; import static com.google.common.util.concurrent.Service.State.RUNNING; @@ -25,8 +26,8 @@ import static com.google.common.util.concurrent.Service.State.STOPPING; import static com.google.common.util.concurrent.Service.State.TERMINATED; import static java.util.Objects.requireNonNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; +import com.google.common.annotations.J2ktIncompatible; import com.google.common.util.concurrent.Monitor.Guard; import com.google.common.util.concurrent.Service.State; // javadoc needs this import com.google.errorprone.annotations.CanIgnoreReturnValue; @@ -49,6 +50,7 @@ import javax.annotation.CheckForNull; * @since 1.0 */ @GwtIncompatible +@J2ktIncompatible @ElementTypesAreNonnullByDefault public abstract class AbstractService implements Service { private static final ListenerCallQueue.Event<Listener> STARTING_EVENT = @@ -236,7 +238,6 @@ public abstract class AbstractService implements Service { * * @since 27.0 */ - @Beta @ForOverride protected void doCancelStart() {} @@ -249,6 +250,7 @@ public abstract class AbstractService implements Service { enqueueStartingEvent(); doStart(); } catch (Throwable startupFailure) { + restoreInterruptIfIsInterruptedException(startupFailure); notifyFailed(startupFailure); } finally { monitor.leave(); @@ -288,6 +290,7 @@ public abstract class AbstractService implements Service { throw new AssertionError("isStoppable is incorrectly implemented, saw: " + previous); } } catch (Throwable shutdownFailure) { + restoreInterruptIfIsInterruptedException(shutdownFailure); notifyFailed(shutdownFailure); } finally { monitor.leave(); @@ -316,7 +319,7 @@ public abstract class AbstractService implements Service { monitor.leave(); } } else { - // It is possible due to races the we are currently in the expected state even though we + // It is possible due to races that we are currently in the expected state even though we // timed out. e.g. if we weren't event able to grab the lock within the timeout we would never // even check the guard. I don't think we care too much about this use case but it could lead // to a confusing error message. @@ -343,7 +346,7 @@ public abstract class AbstractService implements Service { monitor.leave(); } } else { - // It is possible due to races the we are currently in the expected state even though we + // It is possible due to races that we are currently in the expected state even though we // timed out. e.g. if we weren't event able to grab the lock within the timeout we would never // even check the guard. I don't think we care too much about this use case but it could lead // to a confusing error message. |