use of com.hazelcast.cp.internal.RaftOp in project hazelcast by hazelcast.
the class AbstractSessionMessageTask method processMessage.
@Override
protected final void processMessage() {
CPGroupId groupId = getGroupId();
RaftOp raftOp = getRaftOp();
invoke(groupId, raftOp);
}
use of com.hazelcast.cp.internal.RaftOp in project hazelcast by hazelcast.
the class SessionlessSemaphoreProxy method increasePermits.
@Override
public void increasePermits(int increase) {
checkNotNegative(increase, "Increase must be non-negative!");
if (increase == 0) {
return;
}
long clusterWideThreadId = getOrCreateUniqueThreadId();
RaftOp op = new ChangePermitsOp(objectName, NO_SESSION_ID, clusterWideThreadId, newUnsecureUUID(), increase);
invocationManager.invoke(groupId, op).joinInternal();
}
use of com.hazelcast.cp.internal.RaftOp in project hazelcast by hazelcast.
the class SessionlessSemaphoreProxy method drainPermits.
@Override
public int drainPermits() {
long clusterWideThreadId = getOrCreateUniqueThreadId();
RaftOp op = new DrainPermitsOp(objectName, NO_SESSION_ID, clusterWideThreadId, newUnsecureUUID());
return invocationManager.<Integer>invoke(groupId, op).joinInternal();
}
use of com.hazelcast.cp.internal.RaftOp in project hazelcast by hazelcast.
the class SessionlessSemaphoreProxy method reducePermits.
@Override
public void reducePermits(int reduction) {
checkNotNegative(reduction, "Reduction must be non-negative!");
if (reduction == 0) {
return;
}
long clusterWideThreadId = getOrCreateUniqueThreadId();
RaftOp op = new ChangePermitsOp(objectName, NO_SESSION_ID, clusterWideThreadId, newUnsecureUUID(), -reduction);
invocationManager.invoke(groupId, op).joinInternal();
}
use of com.hazelcast.cp.internal.RaftOp in project hazelcast by hazelcast.
the class SessionlessSemaphoreProxy method tryAcquire.
@Override
public boolean tryAcquire(int permits, long timeout, TimeUnit unit) {
checkPositive("permits", permits);
long clusterWideThreadId = getOrCreateUniqueThreadId();
long timeoutMs = max(0, unit.toMillis(timeout));
RaftOp op = new AcquirePermitsOp(objectName, NO_SESSION_ID, clusterWideThreadId, newUnsecureUUID(), permits, timeoutMs);
try {
return invocationManager.<Boolean>invoke(groupId, op).joinInternal();
} catch (WaitKeyCancelledException e) {
throw new IllegalStateException("Semaphore[" + objectName + "] not acquired because the acquire call " + "on the CP group is cancelled, possibly because of another indeterminate call from the same thread.");
}
}
Aggregations