use of com.hazelcast.concurrent.lock.LockStoreImpl in project hazelcast by hazelcast.
the class UnlockOperation method unlock.
protected final void unlock() {
LockStoreImpl lockStore = getLockStore();
boolean unlocked = lockStore.unlock(key, getCallerUuid(), threadId, getReferenceCallId());
response = unlocked;
if (!unlocked) {
// we can not check for retry here, hence just throw the exception
String ownerInfo = lockStore.getOwnerInfo(key);
throw new IllegalMonitorStateException("Current thread is not owner of the lock! -> " + ownerInfo);
}
}
use of com.hazelcast.concurrent.lock.LockStoreImpl in project hazelcast by hazelcast.
the class UnlockOperation method forceUnlock.
protected final void forceUnlock() {
LockStoreImpl lockStore = getLockStore();
response = lockStore.forceUnlock(key);
}
use of com.hazelcast.concurrent.lock.LockStoreImpl in project hazelcast by hazelcast.
the class MultiMapLockTest method lockStoreShouldBeRemoved_whenMultimapIsDestroyed.
/**
* See issue #4888
*/
@Test
public void lockStoreShouldBeRemoved_whenMultimapIsDestroyed() {
HazelcastInstance hz = createHazelcastInstance();
MultiMap multiMap = hz.getMultiMap(randomName());
for (int i = 0; i < 1000; i++) {
multiMap.lock(i);
}
multiMap.destroy();
NodeEngineImpl nodeEngine = getNodeEngineImpl(hz);
LockServiceImpl lockService = nodeEngine.getService(LockService.SERVICE_NAME);
int partitionCount = nodeEngine.getPartitionService().getPartitionCount();
for (int i = 0; i < partitionCount; i++) {
LockStoreContainer lockContainer = lockService.getLockContainer(i);
Collection<LockStoreImpl> lockStores = lockContainer.getLockStores();
assertEquals("LockStores should be empty: " + lockStores, 0, lockStores.size());
}
}
Aggregations