code: protected final void updateState(int shardStateIndex, SequenceNumber lastSequenceNumber) {
  		synchronized (checkpointLock) {
  			subscribedShardsState.get(shardStateIndex).setLastProcessedSequenceNum(lastSequenceNumber);
  
  			// if a shard's state is updated to be SENTINEL_SHARD_ENDING_SEQUENCE_NUM by its consumer thread,
  			// we've finished reading the shard and should determine it to be non-active
  			if (lastSequenceNumber.equals(SentinelSequenceNumber.SENTINEL_SHARD_ENDING_SEQUENCE_NUM.get())) {
  				LOG.info("Subtask {} has reached the end of subscribed shard: {}",
  					indexOfThisConsumerSubtask, subscribedShardsState.get(shardStateIndex).getStreamShardHandle());
  
  				// check if we need to mark the source as idle;
  				// note that on resharding, if registerNewSubscribedShardState was invoked for newly discovered shards
  				// AFTER the old shards had reached the end, the subtask's status will be automatically toggled back to
  				// be active immediately afterwards as soon as we collect records from the new shards
  				if (this.numberOfActiveShards.decrementAndGet() == 0) {
  					LOG.info("Subtask {} has reached the end of all currently subscribed shards; marking the subtask as temporarily idle ...",
  						indexOfThisConsumerSubtask);
  
  					sourceContext.markAsTemporarilyIdle();
  				}
  			}
  		}
  	}
docs: Update the shard to last processed sequence number state.
  This method is called by {@link ShardConsumer}s.
  
  @param shardStateIndex index of the shard to update in subscribedShardsState;
  this index should be the returned value from
  {@link KinesisDataFetcher#registerNewSubscribedShardState(KinesisStreamShardState)}, called
  when the shard state was registered.
  @param lastSequenceNumber the last sequence number value to update