use of com.hazelcast.cp.lock.exception.LockAcquireLimitReachedException in project hazelcast by hazelcast.
the class AbstractFencedLockProxy method lockInterruptibly.
@Override
public void lockInterruptibly() throws InterruptedException {
long threadId = getThreadId();
UUID invocationUid = newUnsecureUUID();
for (; ; ) {
long sessionId = acquireSession();
verifyLockedSessionIdIfPresent(threadId, sessionId, true);
try {
long fence = doLock(sessionId, threadId, invocationUid).get();
if (fence != INVALID_FENCE) {
lockedSessionIds.put(threadId, sessionId);
return;
}
throw new LockAcquireLimitReachedException("Lock[" + objectName + "] reentrant lock limit is already reached!");
} catch (SessionExpiredException e) {
invalidateSession(sessionId);
verifyNoLockedSessionIdPresent(threadId);
} catch (WaitKeyCancelledException e) {
releaseSession(sessionId);
throw new IllegalMonitorStateException("Lock[" + objectName + "] not acquired because the lock call " + "on the CP group is cancelled, possibly because of another indeterminate call from the same thread.");
} catch (Throwable t) {
releaseSession(sessionId);
if (t instanceof InterruptedException) {
throw (InterruptedException) t;
} else {
throw rethrow(t);
}
}
}
}
use of com.hazelcast.cp.lock.exception.LockAcquireLimitReachedException in project hazelcast by hazelcast.
the class AbstractFencedLockProxy method lockAndGetFence.
@Override
public final long lockAndGetFence() {
long threadId = getThreadId();
UUID invocationUid = newUnsecureUUID();
for (; ; ) {
long sessionId = acquireSession();
verifyLockedSessionIdIfPresent(threadId, sessionId, true);
try {
long fence = doLock(sessionId, threadId, invocationUid).joinInternal();
if (fence != INVALID_FENCE) {
lockedSessionIds.put(threadId, sessionId);
return fence;
}
throw new LockAcquireLimitReachedException("Lock[" + objectName + "] reentrant lock limit is already reached!");
} catch (SessionExpiredException e) {
invalidateSession(sessionId);
verifyNoLockedSessionIdPresent(threadId);
} catch (WaitKeyCancelledException e) {
releaseSession(sessionId);
throw new IllegalMonitorStateException("Lock[" + objectName + "] not acquired because the lock call " + "on the CP group is cancelled, possibly because of another indeterminate call from the same thread.");
} catch (Throwable t) {
releaseSession(sessionId);
throw rethrow(t);
}
}
}
Aggregations