use of com.hazelcast.concurrent.lock.LockStore in project hazelcast by hazelcast.
the class PartitionControlledIdTest method testLock.
@Test
public void testLock() throws Exception {
String partitionKey = "hazelcast";
HazelcastInstance hz = getHazelcastInstance(partitionKey);
ILock lock = hz.getLock("lock@" + partitionKey);
lock.lock();
assertEquals("lock@" + partitionKey, lock.getName());
assertEquals(partitionKey, lock.getPartitionKey());
Node node = getNode(hz);
LockServiceImpl lockService = node.nodeEngine.getService(LockServiceImpl.SERVICE_NAME);
Partition partition = instances[0].getPartitionService().getPartition(partitionKey);
LockStore lockStore = lockService.getLockStore(partition.getPartitionId(), new InternalLockNamespace(lock.getName()));
Data key = node.getSerializationService().toData(lock.getName(), StringPartitioningStrategy.INSTANCE);
assertTrue(lockStore.isLocked(key));
}
Aggregations