Fixed - RSemaphore permits can't be acquired due to "Maximum permit count exceeded" error #3573

pull/3588/merge
Nikita Koksharov 4 years ago
parent 79978f1eef
commit add9c68333

@ -20,9 +20,14 @@ import java.util.concurrent.Semaphore;
import org.redisson.misc.RPromise;
/**
*
* @author Nikita Koksharov
*
*/
public class RedissonLockEntry implements PubSubEntry<RedissonLockEntry> {
private int counter;
private volatile int counter;
private final Semaphore latch;
private final RPromise<RedissonLockEntry> promise;
@ -34,6 +39,10 @@ public class RedissonLockEntry implements PubSubEntry<RedissonLockEntry> {
this.promise = promise;
}
public int acquired() {
return counter;
}
public void acquire() {
counter++;
}

@ -41,7 +41,7 @@ public class SemaphorePubSub extends PublishSubscribe<RedissonLockEntry> {
runnableToExecute.run();
}
value.getLatch().release(Math.min(value.getLatch().getQueueLength(), message.intValue()));
value.getLatch().release(Math.min(value.acquired(), message.intValue()));
}
}

Loading…
Cancel
Save