gaurav-narula commented on code in PR #13949:
URL: https://github.com/apache/kafka/pull/13949#discussion_r1252045094


##########
core/src/main/scala/kafka/server/DelayedProduce.scala:
##########
@@ -58,6 +62,8 @@ class DelayedProduce(delayMs: Long,
                      lockOpt: Option[Lock] = None)
   extends DelayedOperation(delayMs, lockOpt) {
 
+  override lazy val logger = DelayedProduce.logger

Review Comment:
   Thanks for reviewing this!
   
   If I understand this correctly, I believe you're suggesting to replace the 
declaration in the [Logging 
trait](https://github.com/apache/kafka/blob/5c2492bca71200806ccf776ea31639a90290d43e/core/src/main/scala/kafka/utils/Logging.scala#L43)
 to be a `protected def logger = Logger(LoggerFactory.getLogger(loggerName))` 
instead of `protected lazy val logger = 
Logger(LoggerFactory.getLogger(loggerName))`
   
   I think that will result in a logger being instantiated for each usage of 
`logger` which are *not* overridden by a `lazy val`. This is something I reckon 
we should avoid as it exacerbates the problem. [This 
example](https://scastie.scala-lang.org/X2OWyu5BRJKXRA81zxsgJw) in the 
playground demonstrates the behaviour.
   
   Please let me know your thoughts and if there's something I overlooked or 
misunderstood :)



-- 
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

Reply via email to