use of com.hazelcast.internal.locksupport.LockStoreImpl in project hazelcast by hazelcast.
the class UnlockBackupOperation method run.
@Override
public void run() throws Exception {
LockStoreImpl lockStore = getLockStore();
boolean unlocked;
if (force) {
unlocked = lockStore.forceUnlock(key);
} else {
unlocked = lockStore.unlock(key, originalCallerUuid, threadId, getReferenceCallId());
}
response = unlocked;
}
use of com.hazelcast.internal.locksupport.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);
} else {
ILogger logger = getLogger();
if (logger.isFinestEnabled()) {
logger.finest("Released lock " + namespace.getObjectName());
}
}
}
use of com.hazelcast.internal.locksupport.LockStoreImpl in project hazelcast by hazelcast.
the class LockBackupOperation method run.
@Override
public void run() throws Exception {
if (isClient) {
ClientEngine clientEngine = getNodeEngine().getService(ClientEngineImpl.SERVICE_NAME);
clientEngine.onClientAcquiredResource(originalCallerUuid);
}
interceptLockOperation();
LockStoreImpl lockStore = getLockStore();
response = lockStore.lock(key, originalCallerUuid, threadId, getReferenceCallId(), leaseTime);
}
use of com.hazelcast.internal.locksupport.LockStoreImpl in project hazelcast by hazelcast.
the class LocalLockCleanupOperation method run.
@Override
public void run() throws Exception {
LockStoreImpl lockStore = getLockStore();
LockResource lock = lockStore.getLock(key);
if (uuid.equals(lock.getOwner())) {
ILogger logger = getLogger();
if (logger.isFinestEnabled()) {
logger.finest("Unlocking lock owned by UUID: " + uuid + ", thread ID: " + lock.getThreadId() + ", count: " + lock.getLockCount());
}
response = lockStore.forceUnlock(key);
}
}
use of com.hazelcast.internal.locksupport.LockStoreImpl in project hazelcast by hazelcast.
the class MultiMapLockTest method lockStoreShouldBeRemoved_whenMultimapIsDestroyed.
/**
* See issue #4888
*/
@Test
public void lockStoreShouldBeRemoved_whenMultimapIsDestroyed() {
HazelcastInstance hz = createHazelcastInstance();
MultiMap<String, Integer> multiMap = hz.getMultiMap(randomName());
for (int i = 0; i < 1000; i++) {
multiMap.lock("" + i);
}
multiMap.destroy();
NodeEngineImpl nodeEngine = getNodeEngineImpl(hz);
LockSupportServiceImpl lockService = nodeEngine.getService(LockSupportService.SERVICE_NAME);
int partitionCount = nodeEngine.getPartitionService().getPartitionCount();
for (int i = 0; i < partitionCount; i++) {
LockStoreContainer lockContainer = lockService.getLockContainer(i);
Collection<LockStoreImpl> lockStores = lockContainer.getLockStores().stream().filter(s -> !s.getNamespace().getObjectName().startsWith(JobRepository.INTERNAL_JET_OBJECTS_PREFIX)).collect(Collectors.toList());
assertEquals("LockStores should be empty: " + lockStores, 0, lockStores.size());
}
}
Aggregations