yashmayya commented on code in PR #14847:
URL: https://github.com/apache/pinot/pull/14847#discussion_r1926891018


##########
pinot-common/src/main/java/org/apache/pinot/common/concurrency/AdjustableSemaphore.java:
##########
@@ -20,32 +20,44 @@
 
 import com.google.common.base.Preconditions;
 import java.util.concurrent.Semaphore;
+import java.util.concurrent.atomic.AtomicInteger;
 
 
 /**
  * A semaphore that allows adjusting the number of permits in a non-blocking 
way.
  */
 public class AdjustableSemaphore extends Semaphore {
 
-  private int _totalPermits;
+  private final AtomicInteger _totalPermits;

Review Comment:
   The value is exposed via the public method `getTotalPermits` and can be 
modified concurrently via `setPermits` so I made it atomic for thread safety 
without synchronization.



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

Reply via email to