use of com.hazelcast.cp.lock.exception.LockOwnershipLostException in project hazelcast by hazelcast.
the class AbstractFencedLockBasicTest method testUnlockFails_whenNewSessionCreated.
@Test
public void testUnlockFails_whenNewSessionCreated() throws ExecutionException, InterruptedException {
long fence = lock.lockAndGetFence();
assertValidFence(fence);
AbstractProxySessionManager sessionManager = getSessionManager(proxyInstance);
RaftGroupId groupId = (RaftGroupId) lock.getGroupId();
long sessionId = sessionManager.getSession(groupId);
assertNotEquals(NO_SESSION_ID, sessionId);
closeSession(instances[0], groupId, sessionId);
assertTrueEventually(() -> assertNotEquals(sessionId, sessionManager.getSession(groupId)));
lockByOtherThread(lock);
try {
lock.unlock();
} catch (LockOwnershipLostException ignored) {
}
assertFalse(lock.isLockedByCurrentThread());
}
Aggregations