use of com.hazelcast.internal.locksupport.LockStoreContainer in project hazelcast by hazelcast.
the class LockReplicationOperation method run.
@Override
public void run() {
LockSupportServiceImpl lockService = getService();
LockStoreContainer container = lockService.getLockContainer(getPartitionId());
for (LockStoreImpl ls : locks) {
container.put(ls);
}
}
use of com.hazelcast.internal.locksupport.LockStoreContainer in project hazelcast by hazelcast.
the class MapLockTest method lockStoreShouldBeRemoved_whenMapIsDestroyed.
/**
* See issue #4888
*/
@Test
public void lockStoreShouldBeRemoved_whenMapIsDestroyed() {
HazelcastInstance instance = createHazelcastInstance(getConfig());
IMap<Integer, Integer> map = instance.getMap(randomName());
for (int i = 0; i < 1000; i++) {
map.lock(i);
}
map.destroy();
NodeEngineImpl nodeEngine = getNodeEngineImpl(instance);
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", 0, lockStores.size());
}
}
use of com.hazelcast.internal.locksupport.LockStoreContainer 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