Search in sources :

Example 1 with AcquireResult

use of com.hazelcast.cp.internal.datastructures.semaphore.AcquireResult in project hazelcast by hazelcast.

the class AcquirePermitsOp method run.

@Override
public Object run(CPGroupId groupId, long commitIndex) {
    SemaphoreService service = getService();
    AcquireInvocationKey key = new AcquireInvocationKey(commitIndex, invocationUid, callerAddress, callId, getSemaphoreEndpoint(), permits);
    AcquireResult result = service.acquirePermits(groupId, name, key, timeoutMs);
    if (result.status() == WAIT_KEY_ADDED) {
        return PostponedResponse.INSTANCE;
    }
    return result.status() == SUCCESSFUL;
}
Also used : AcquireInvocationKey(com.hazelcast.cp.internal.datastructures.semaphore.AcquireInvocationKey) SemaphoreService(com.hazelcast.cp.internal.datastructures.semaphore.SemaphoreService) AcquireResult(com.hazelcast.cp.internal.datastructures.semaphore.AcquireResult)

Aggregations

AcquireInvocationKey (com.hazelcast.cp.internal.datastructures.semaphore.AcquireInvocationKey)1 AcquireResult (com.hazelcast.cp.internal.datastructures.semaphore.AcquireResult)1 SemaphoreService (com.hazelcast.cp.internal.datastructures.semaphore.SemaphoreService)1