mirror of https://github.com/apache/druid.git
GracefulShutdownFirehose: MutableBoolean -> AtomicBoolean
This commit is contained in:
parent
424e899760
commit
ce1ef94061
|
@ -18,6 +18,7 @@ import java.io.IOException;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
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 ScheduledExecutorService scheduledExecutor;
|
||||||
private final RejectionPolicy rejectionPolicy;
|
private final RejectionPolicy rejectionPolicy;
|
||||||
|
|
||||||
private final MutableBoolean hasMore = new MutableBoolean(true);
|
private final AtomicBoolean hasMore = new AtomicBoolean(true);
|
||||||
private volatile boolean shutdown = false;
|
private volatile boolean shutdown = false;
|
||||||
|
|
||||||
public GracefulShutdownFirehose(
|
public GracefulShutdownFirehose(
|
||||||
|
@ -74,7 +75,7 @@ public class GracefulShutdownFirehose implements Firehose
|
||||||
public ScheduledExecutors.Signal call() throws Exception
|
public ScheduledExecutors.Signal call() throws Exception
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
hasMore.setValue(false);
|
hasMore.set(false);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
throw Throwables.propagate(e);
|
throw Throwables.propagate(e);
|
||||||
|
@ -91,7 +92,7 @@ public class GracefulShutdownFirehose implements Firehose
|
||||||
@Override
|
@Override
|
||||||
public boolean hasMore()
|
public boolean hasMore()
|
||||||
{
|
{
|
||||||
return hasMore.booleanValue() && firehose.hasMore();
|
return hasMore.get() && firehose.hasMore();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue