re-adding some comments explaining context for a conditional

This commit is contained in:
Shitanshu Aggarwal 2019-10-30 01:11:08 +00:00
parent af46774a11
commit 4239593942

View file

@ -905,6 +905,13 @@ public class Worker implements Runnable {
ShardConsumer consumer = shardInfoShardConsumerMap.get(shardInfo); ShardConsumer consumer = shardInfoShardConsumerMap.get(shardInfo);
if (consumer == null || ConsumerStates.ShardConsumerState.SHUTDOWN_COMPLETE.equals(consumer.getCurrentState())) { if (consumer == null || ConsumerStates.ShardConsumerState.SHUTDOWN_COMPLETE.equals(consumer.getCurrentState())) {
//
// CASE1: There is a race condition between retrieving the current assignments, and creating the
// notification. If the a lease is lost in between these two points, we explicitly decrement the
// notification latches to clear the shutdown.
//
// CASE2: The shard consumer is in SHUTDOWN_COMPLETE state and will not decrement the latches by itself.
//
notificationCompleteLatch.countDown(); notificationCompleteLatch.countDown();
shutdownCompleteLatch.countDown(); shutdownCompleteLatch.countDown();
} else { } else {