use of com.hazelcast.concurrent.lock.LockService in project hazelcast by hazelcast.
the class PartitionContainer method clearLockStore.
private void clearLockStore(String name) {
final NodeEngine nodeEngine = mapService.getMapServiceContext().getNodeEngine();
final LockService lockService = nodeEngine.getSharedService(LockService.SERVICE_NAME);
if (lockService != null) {
final DefaultObjectNamespace namespace = new DefaultObjectNamespace(MapService.SERVICE_NAME, name);
lockService.clearLockStore(partitionId, namespace);
}
}
use of com.hazelcast.concurrent.lock.LockService in project hazelcast by hazelcast.
the class MultiMapPartitionContainer method clearLockStore.
private void clearLockStore(String name) {
NodeEngine nodeEngine = service.getNodeEngine();
LockService lockService = nodeEngine.getSharedService(LockService.SERVICE_NAME);
if (lockService != null) {
DefaultObjectNamespace namespace = new DefaultObjectNamespace(MultiMapService.SERVICE_NAME, name);
lockService.clearLockStore(partitionId, namespace);
}
}
use of com.hazelcast.concurrent.lock.LockService in project hazelcast by hazelcast.
the class MapTransactionTest method testGetForUpdate_releasesBackupLock.
@Test
public void testGetForUpdate_releasesBackupLock() {
Config config = getConfig();
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
HazelcastInstance instance1 = factory.newHazelcastInstance(config);
HazelcastInstance instance2 = factory.newHazelcastInstance(config);
final String keyOwnedByInstance2 = generateKeyOwnedBy(instance2);
instance1.executeTransaction(new TransactionalTask<Object>() {
@Override
public Object execute(TransactionalTaskContext context) throws TransactionException {
TransactionalMap<Object, Object> map = context.getMap(randomString());
map.getForUpdate(keyOwnedByInstance2);
return null;
}
});
Node node = TestUtil.getNode(instance1);
Data keyData = node.nodeEngine.toData(keyOwnedByInstance2);
LockService lockService = node.nodeEngine.getService(LockService.SERVICE_NAME);
for (LockResource lockResource : lockService.getAllLocks()) {
if (keyData.equals(lockResource.getKey())) {
assertEquals(0, lockResource.getLockCount());
}
}
}
use of com.hazelcast.concurrent.lock.LockService in project hazelcast by hazelcast.
the class MapManagedService method init.
@Override
public void init(NodeEngine nodeEngine, Properties properties) {
final LockService lockService = nodeEngine.getSharedService(LockService.SERVICE_NAME);
if (lockService != null) {
lockService.registerLockStoreConstructor(MapService.SERVICE_NAME, new ObjectNamespaceLockStoreInfoConstructorFunction());
}
mapServiceContext.initPartitionsContainers();
mapServiceContext.getExpirationManager().start();
}
use of com.hazelcast.concurrent.lock.LockService in project hazelcast by hazelcast.
the class MultiMapContainer method destroy.
public void destroy() {
final LockService lockService = nodeEngine.getSharedService(LockService.SERVICE_NAME);
if (lockService != null) {
lockService.clearLockStore(partitionId, lockNamespace);
}
multiMapValues.clear();
}
Aggregations