From ce1ef94061ff7e9f0f5aa2189c6ad61a87d582ac Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Tue, 19 Mar 2013 18:16:13 -0700 Subject: [PATCH] GracefulShutdownFirehose: MutableBoolean -> AtomicBoolean --- .../metamx/druid/realtime/GracefulShutdownFirehose.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/realtime/src/main/java/com/metamx/druid/realtime/GracefulShutdownFirehose.java b/realtime/src/main/java/com/metamx/druid/realtime/GracefulShutdownFirehose.java index cea0d3c7b51..23c7122be38 100644 --- a/realtime/src/main/java/com/metamx/druid/realtime/GracefulShutdownFirehose.java +++ b/realtime/src/main/java/com/metamx/druid/realtime/GracefulShutdownFirehose.java @@ -18,6 +18,7 @@ import java.io.IOException; import java.util.concurrent.Callable; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.atomic.AtomicBoolean; /** */ @@ -31,7 +32,7 @@ public class GracefulShutdownFirehose implements Firehose private final ScheduledExecutorService scheduledExecutor; private final RejectionPolicy rejectionPolicy; - private final MutableBoolean hasMore = new MutableBoolean(true); + private final AtomicBoolean hasMore = new AtomicBoolean(true); private volatile boolean shutdown = false; public GracefulShutdownFirehose( @@ -74,7 +75,7 @@ public class GracefulShutdownFirehose implements Firehose public ScheduledExecutors.Signal call() throws Exception { try { - hasMore.setValue(false); + hasMore.set(false); } catch (Exception e) { throw Throwables.propagate(e); @@ -91,7 +92,7 @@ public class GracefulShutdownFirehose implements Firehose @Override public boolean hasMore() { - return hasMore.booleanValue() && firehose.hasMore(); + return hasMore.get() && firehose.hasMore(); } @Override