Skip to content
Permalink
Browse files
Fix acquire retry idempotency in RaftSemaphore
  • Loading branch information
metanet authored and mdogan committed Feb 1, 2019
1 parent 0bb6683 commit 5cc891650929392307ae6c344c759f1e63501cf2
Showing with 6 additions and 0 deletions.
  1. +6 −0 hazelcast-raft-dataservices/src/main/java/com/hazelcast/raft/service/semaphore/RaftSemaphore.java
@@ -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.