public HashMap < KafkaTopicPartition , Long > snapshotCurrentState ( ) { // this method assumes that the checkpoint lock is held assert Thread . holdsLock ( checkpointLock ) ; HashMap < KafkaTopicPartition , Long > state = new HashMap <> ( subscribedPartitionStates . size ( ) ) ; for ( KafkaTopicPartitionState < KPH > partition : subscribedPartitionStates ) { state . put ( partition . getKafkaTopicPartition ( ) , partition . getOffset ( ) ) ; } return state ; }
Takes a snapshot of the partition offsets .