This commit is contained in:
Tom Coupland 2018-02-24 15:55:17 +00:00 committed by GitHub
commit a73bcffc9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -102,6 +102,8 @@ public class Worker implements Runnable {
private volatile boolean shutdown; private volatile boolean shutdown;
private volatile long shutdownStartTimeMillis; private volatile long shutdownStartTimeMillis;
private volatile boolean shutdownComplete = false; private volatile boolean shutdownComplete = false;
private volatile boolean initialized = false;
// Holds consumers for shards the worker is currently tracking. Key is shard // Holds consumers for shards the worker is currently tracking. Key is shard
// info, value is ShardConsumer. // info, value is ShardConsumer.
@ -543,6 +545,7 @@ public class Worker implements Runnable {
if (!isDone) { if (!isDone) {
throw new RuntimeException(lastException); throw new RuntimeException(lastException);
} }
initialized = true;
} }
/** /**
@ -750,6 +753,10 @@ public class Worker implements Runnable {
boolean isShutdownComplete() { boolean isShutdownComplete() {
return shutdownComplete; return shutdownComplete;
} }
public boolean isInitialized() {
return initialized;
}
ConcurrentMap<ShardInfo, ShardConsumer> getShardInfoShardConsumerMap() { ConcurrentMap<ShardInfo, ShardConsumer> getShardInfoShardConsumerMap() {
return shardInfoShardConsumerMap; return shardInfoShardConsumerMap;
@ -800,8 +807,9 @@ public class Worker implements Runnable {
} }
if (metricsFactory instanceof WorkerCWMetricsFactory) { if (metricsFactory instanceof WorkerCWMetricsFactory) {
((CWMetricsFactory) metricsFactory).shutdown(); ((CWMetricsFactory) metricsFactory).shutdown();
} }
shutdownComplete = true; initialized = false;
shutdownComplete = true;
} }
/** /**