Skip to content
Permalink
Browse files

Fix acquire retry idempotency in RaftSemaphore

  • Loading branch information...
metanet authored and mdogan committed Sep 18, 2018
1 parent 0bb6683 commit 5cc891650929392307ae6c344c759f1e63501cf2
@@ -93,7 +93,13 @@ boolean isAvailable(int permits) {
}

AcquireResult acquire(SemaphoreInvocationKey key, boolean wait) {
SessionState state = sessionStates.get(key.sessionId());
if (state != null && state.acquires.containsKey(key.invocationUid())) {
return new AcquireResult(key.permits(), Collections.<SemaphoreInvocationKey>emptyList());
}

Collection<SemaphoreInvocationKey> cancelled = cancelWaitKeys(key.sessionId(), key.threadId(), key.invocationUid());

if (!isAvailable(key.permits())) {
if (wait) {
waitKeys.add(key);

0 comments on commit 5cc8916

Please sign in to comment.
You can’t perform that action at this time.