divijvaidya commented on code in PR #13096: URL: https://github.com/apache/kafka/pull/13096#discussion_r1067068943
########## core/src/main/scala/kafka/log/LogCleanerManager.scala: ########## @@ -321,14 +321,7 @@ private[log] class LogCleanerManager(val logDirs: Seq[File], * Check if the cleaning for a partition is in a particular state. The caller is expected to hold lock while making the call. */ private def isCleaningInState(topicPartition: TopicPartition, expectedState: LogCleaningState): Boolean = { - inProgress.get(topicPartition) match { - case None => false - case Some(state) => - if (state == expectedState) - true - else - false - } + inProgress.get(topicPartition).contains(expectedState) Review Comment: FYI reviewers - No new object allocation here inside `Option.contains`. Implementation of contains: ``` final def contains[A1 >: A](elem: A1): Boolean = !isEmpty && this.get == elem ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org