diff options
Diffstat (limited to 'android/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java')
-rw-r--r-- | android/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/android/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java b/android/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java index 0b7d34e6b..594496884 100644 --- a/android/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java +++ b/android/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java @@ -37,7 +37,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; -import java.util.logging.Logger; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; @@ -102,7 +101,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; @J2ktIncompatible @ElementTypesAreNonnullByDefault public abstract class AbstractScheduledService implements Service { - private static final Logger logger = Logger.getLogger(AbstractScheduledService.class.getName()); + private static final LazyLogger logger = new LazyLogger(AbstractScheduledService.class); /** * A scheduler defines the policy for how the {@link AbstractScheduledService} should run its @@ -209,10 +208,12 @@ public abstract class AbstractScheduledService implements Service { shutDown(); } catch (Exception ignored) { restoreInterruptIfIsInterruptedException(ignored); - logger.log( - Level.WARNING, - "Error while attempting to shut down the service after failure.", - ignored); + logger + .get() + .log( + Level.WARNING, + "Error while attempting to shut down the service after failure.", + ignored); } notifyFailed(t); // requireNonNull is safe now, just as it was above. @@ -564,7 +565,9 @@ public abstract class AbstractScheduledService implements Service { lock.lock(); try { toReturn = initializeOrUpdateCancellationDelegate(schedule); - } catch (RuntimeException | Error e) { + } catch (Throwable e) { + // Any Exception is either a RuntimeException or sneaky checked exception. + // // If an exception is thrown by the subclass then we need to make sure that the service // notices and transitions to the FAILED state. We do it by calling notifyFailed directly // because the service does not monitor the state of the future so if the exception is not |