use of com.hazelcast.cp.internal.datastructures.semaphore.operation.ChangePermitsOp in project hazelcast by hazelcast.
the class AbstractSemaphoreAdvancedTest method testRetriedDecreasePermitsAppliedOnlyOnce.
@Test
public void testRetriedDecreasePermitsAppliedOnlyOnce() throws InterruptedException {
semaphore.init(2);
semaphore.acquire();
semaphore.release();
// we guarantee that there is a session id now...
RaftGroupId groupId = getGroupId();
long sessionId = getSessionManager().getSession(groupId);
assertNotEquals(NO_SESSION_ID, sessionId);
UUID invUid = newUnsecureUUID();
invokeRaftOp(groupId, new ChangePermitsOp(objectName, sessionId, getThreadId(), invUid, -1)).joinInternal();
invokeRaftOp(groupId, new ChangePermitsOp(objectName, sessionId, getThreadId(), invUid, -1)).joinInternal();
assertEquals(1, semaphore.availablePermits());
}
Aggregations