zhuyaogai commented on code in PR #5217:
URL: https://github.com/apache/kyuubi/pull/5217#discussion_r1315289501
##########
kyuubi-server/src/main/scala/org/apache/kyuubi/session/SessionLimiter.scala:
##########
@@ -95,7 +95,13 @@ class SessionLimiterImpl(userLimit: Int, ipAddressLimit:
Int, userIpAddressLimit
private def decrLimitCount(key: String): Unit = {
_counters.get(key) match {
- case count: AtomicInteger => count.decrementAndGet()
+ case count: AtomicInteger if count.get > 0 =>
+ count.synchronized {
Review Comment:
> It seems like this is enough:
>
> ```
> count.accumulateAndGet(1, (l, r) => if (l > 0) l - r else l)
> ```
@wForget Thanks for your answer, and I have adopted your code suggestions.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]