aboutsummaryrefslogtreecommitdiff
path: root/guava/src/com/google/common/util/concurrent/SequentialExecutor.java
diff options
context:
space:
mode:
Diffstat (limited to 'guava/src/com/google/common/util/concurrent/SequentialExecutor.java')
-rw-r--r--guava/src/com/google/common/util/concurrent/SequentialExecutor.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/guava/src/com/google/common/util/concurrent/SequentialExecutor.java b/guava/src/com/google/common/util/concurrent/SequentialExecutor.java
index c842d7e07..ebc33178d 100644
--- a/guava/src/com/google/common/util/concurrent/SequentialExecutor.java
+++ b/guava/src/com/google/common/util/concurrent/SequentialExecutor.java
@@ -31,7 +31,6 @@ import java.util.Deque;
import java.util.concurrent.Executor;
import java.util.concurrent.RejectedExecutionException;
import java.util.logging.Level;
-import java.util.logging.Logger;
import javax.annotation.CheckForNull;
/**
@@ -52,7 +51,7 @@ import javax.annotation.CheckForNull;
@GwtIncompatible
@ElementTypesAreNonnullByDefault
final class SequentialExecutor implements Executor {
- private static final Logger log = Logger.getLogger(SequentialExecutor.class.getName());
+ private static final LazyLogger log = new LazyLogger(SequentialExecutor.class);
enum WorkerRunningState {
/** Runnable is not running and not queued for execution */
@@ -136,7 +135,8 @@ final class SequentialExecutor implements Executor {
try {
executor.execute(worker);
- } catch (RuntimeException | Error t) {
+ } catch (Throwable t) {
+ // Any Exception is either a RuntimeException or sneaky checked exception.
synchronized (queue) {
boolean removed =
(workerRunningState == IDLE || workerRunningState == QUEUING)
@@ -202,6 +202,7 @@ final class SequentialExecutor implements Executor {
* will still be present. If the composed Executor is an ExecutorService, it can respond to
* shutdown() by returning tasks queued on that Thread after {@link #worker} drains the queue.
*/
+ @SuppressWarnings("CatchingUnchecked") // sneaky checked exception
private void workOnQueue() {
boolean interruptedDuringTask = false;
boolean hasSetRunning = false;
@@ -235,8 +236,8 @@ final class SequentialExecutor implements Executor {
interruptedDuringTask |= Thread.interrupted();
try {
task.run();
- } catch (RuntimeException e) {
- log.log(Level.SEVERE, "Exception while executing runnable " + task, e);
+ } catch (Exception e) { // sneaky checked exception
+ log.get().log(Level.SEVERE, "Exception while executing runnable " + task, e);
} finally {
task = null;
}