jlprat commented on code in PR #15279:
URL: https://github.com/apache/kafka/pull/15279#discussion_r1473118743


##########
core/src/main/scala/kafka/network/RequestChannel.scala:
##########
@@ -92,18 +92,18 @@ object RequestChannel extends Logging {
                 val envelope: Option[RequestChannel.Request] = None) extends 
BaseRequest {
     // These need to be volatile because the readers are in the network thread 
and the writers are in the request
     // handler threads or the purgatory threads
-    @volatile var requestDequeueTimeNanos = -1L
-    @volatile var apiLocalCompleteTimeNanos = -1L
-    @volatile var responseCompleteTimeNanos = -1L
-    @volatile var responseDequeueTimeNanos = -1L
-    @volatile var messageConversionsTimeNanos = 0L
-    @volatile var apiThrottleTimeMs = 0L
-    @volatile var temporaryMemoryBytes = 0L
+    @volatile var requestDequeueTimeNanos: Long = -1L
+    @volatile var apiLocalCompleteTimeNanos: Long = -1L
+    @volatile var responseCompleteTimeNanos: Long = -1L
+    @volatile var responseDequeueTimeNanos: Long = -1L
+    @volatile var messageConversionsTimeNanos: Long = 0L
+    @volatile var apiThrottleTimeMs: Long = 0L
+    @volatile var temporaryMemoryBytes: Long = 0L
     @volatile var recordNetworkThreadTimeCallback: Option[Long => Unit] = None
     @volatile var callbackRequestDequeueTimeNanos: Option[Long] = None
     @volatile var callbackRequestCompleteTimeNanos: Option[Long] = None
 
-    val session = Session(context.principal, context.clientAddress)
+    val session: Session = Session(context.principal, context.clientAddress)

Review Comment:
   I might have missed some spots where this should be applied but the Scala 
idiomatic approach to this is:
   - public API should be explicitly typed: this applies to `val`s, `var`s and 
`def`s for example. Like the case you comment on.
   - private definitions or variables don't need to be typed. Thanks to Scala 
type inference many `def`s, `var`s and `val`s can omit their explicit type 
making it easy to refactor things. Please note the "don't need to", you can 
still explicitly type those.
   
   Let me know if this answers your question.



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