divijvaidya commented on code in PR #13096:
URL: https://github.com/apache/kafka/pull/13096#discussion_r1067070504
##########
core/src/main/scala/kafka/server/FetchSession.scala:
##########
@@ -705,10 +705,7 @@ class FetchSessionCache(private val maxEntries: Int,
}
def remove(sessionId: Int): Option[FetchSession] = synchronized {
- get(sessionId) match {
- case None => None
- case Some(session) => remove(session)
- }
+ get(sessionId).flatMap(session => remove(session))
Review Comment:
FYI reviewers -
Object allocation is not a problem here because fetch sessions are not
frequently added/removed. They are usually long lived.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]