showuon commented on code in PR #12559:
URL: https://github.com/apache/kafka/pull/12559#discussion_r955860617
##########
core/src/main/scala/kafka/network/SocketServer.scala:
##########
@@ -1546,6 +1546,11 @@ class ConnectionQuotas(config: KafkaConfig, time: Time,
metrics: Metrics) extend
val endThrottleTimeMs = startThrottleTimeMs + throttleTimeMs
var remainingThrottleTimeMs = throttleTimeMs
do {
+ if (remainingThrottleTimeMs == 0) {
+ warn(s"The connection will wait until there's an available
connection slot due to current connection count exceeds configured count.")
+ } else {
+ info(s"The connection will be delayed for for
${remainingThrottleTimeMs}ms due to the connection rate exceeds configured
rate.")
+ }
counts.wait(remainingThrottleTimeMs)
remainingThrottleTimeMs = math.max(endThrottleTimeMs -
time.milliseconds, 0)
} while (remainingThrottleTimeMs > 0 ||
!connectionSlotAvailable(listenerName))
Review Comment:
if `remainingThrottleTimeMs == 0`, it means there's no available connection
slot, and we'll wait forever until there's connection
terminated(`Object.wait(0)` means wait until notified[1]).
[1]
https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-
> If timeout is zero, however, then real time is not taken into
consideration and the thread simply waits until notified.
--
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]