rahulrane50 commented on code in PR #2515:
URL: https://github.com/apache/helix/pull/2515#discussion_r1237649061


##########
meta-client/src/main/java/org/apache/helix/metaclient/recipes/lock/DistributedSemaphore.java:
##########
@@ -75,8 +133,19 @@ public Permit acquire() {
    * @param count number of permits to acquire
    * @return a collection of permits
    */
-  public Collection<Permit> acquire(int count) {
-    throw new NotImplementedException("Not implemented yet.");
+  public synchronized Collection<Permit> acquire(int count) {
+    if (getRemainingCapacity() < count) {
+      LOG.warn("No sufficient permits available. Attempt to acquire {} 
permits, but only {} permits available", count,
+          getRemainingCapacity());
+      return null;
+    } else {
+      updateAcquirePermit(count);

Review Comment:
   I meant different count values for acquire.



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