Search in sources :

Example 1 with LockStoreContainer

use of com.hazelcast.concurrent.lock.LockStoreContainer in project hazelcast by hazelcast.

the class LockReplicationOperation method run.

@Override
public void run() {
    LockServiceImpl lockService = getService();
    LockStoreContainer container = lockService.getLockContainer(getPartitionId());
    for (LockStoreImpl ls : locks) {
        container.put(ls);
    }
}
Also used : LockStoreImpl(com.hazelcast.concurrent.lock.LockStoreImpl) LockServiceImpl(com.hazelcast.concurrent.lock.LockServiceImpl) LockStoreContainer(com.hazelcast.concurrent.lock.LockStoreContainer)

Example 2 with LockStoreContainer

use of com.hazelcast.concurrent.lock.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);
    LockServiceImpl lockService = nodeEngine.getService(LockService.SERVICE_NAME);
    int partitionCount = nodeEngine.getPartitionService().getPartitionCount();
    for (int i = 0; i < partitionCount; i++) {
        LockStoreContainer lockContainer = lockService.getLockContainer(i);
        assertEquals("LockStores should be empty", 0, lockContainer.getLockStores().size());
    }
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) HazelcastInstance(com.hazelcast.core.HazelcastInstance) LockServiceImpl(com.hazelcast.concurrent.lock.LockServiceImpl) LockStoreContainer(com.hazelcast.concurrent.lock.LockStoreContainer) NightlyTest(com.hazelcast.test.annotation.NightlyTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 3 with LockStoreContainer

use of com.hazelcast.concurrent.lock.LockStoreContainer 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());
    }
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) LockStoreImpl(com.hazelcast.concurrent.lock.LockStoreImpl) MultiMap(com.hazelcast.core.MultiMap) HazelcastInstance(com.hazelcast.core.HazelcastInstance) LockServiceImpl(com.hazelcast.concurrent.lock.LockServiceImpl) LockStoreContainer(com.hazelcast.concurrent.lock.LockStoreContainer) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

LockServiceImpl (com.hazelcast.concurrent.lock.LockServiceImpl)3 LockStoreContainer (com.hazelcast.concurrent.lock.LockStoreContainer)3 LockStoreImpl (com.hazelcast.concurrent.lock.LockStoreImpl)2 HazelcastInstance (com.hazelcast.core.HazelcastInstance)2 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)2 ParallelTest (com.hazelcast.test.annotation.ParallelTest)2 QuickTest (com.hazelcast.test.annotation.QuickTest)2 Test (org.junit.Test)2 MultiMap (com.hazelcast.core.MultiMap)1 NightlyTest (com.hazelcast.test.annotation.NightlyTest)1