use of com.hazelcast.internal.locksupport.LockSupportService in project hazelcast by hazelcast.
the class PartitionContainer method clearLockStore.
private void clearLockStore(String name) {
final NodeEngine nodeEngine = mapService.getMapServiceContext().getNodeEngine();
final LockSupportService lockService = nodeEngine.getServiceOrNull(LockSupportService.SERVICE_NAME);
if (lockService != null) {
final ObjectNamespace namespace = MapService.getObjectNamespace(name);
lockService.clearLockStore(partitionId, namespace);
}
}
use of com.hazelcast.internal.locksupport.LockSupportService in project hazelcast by hazelcast.
the class MultiMapPartitionContainer method clearLockStore.
private void clearLockStore(String name) {
NodeEngine nodeEngine = service.getNodeEngine();
LockSupportService lockService = nodeEngine.getServiceOrNull(LockSupportService.SERVICE_NAME);
if (lockService != null) {
DistributedObjectNamespace namespace = new DistributedObjectNamespace(MultiMapService.SERVICE_NAME, name);
lockService.clearLockStore(partitionId, namespace);
}
}
use of com.hazelcast.internal.locksupport.LockSupportService 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;
}
});
NodeEngine nodeEngine = getNodeEngineImpl(instance1);
Data keyData = nodeEngine.toData(keyOwnedByInstance2);
LockSupportService lockService = nodeEngine.getService(LockSupportService.SERVICE_NAME);
for (LockResource lockResource : lockService.getAllLocks()) {
if (keyData.equals(lockResource.getKey())) {
assertEquals(0, lockResource.getLockCount());
}
}
}
use of com.hazelcast.internal.locksupport.LockSupportService in project hazelcast by hazelcast.
the class MapManagedService method init.
@Override
public void init(NodeEngine nodeEngine, Properties properties) {
final LockSupportService lockService = nodeEngine.getServiceOrNull(LockSupportService.SERVICE_NAME);
if (lockService != null) {
lockService.registerLockStoreConstructor(MapService.SERVICE_NAME, new ObjectNamespaceLockStoreInfoConstructorFunction());
}
mapServiceContext.initPartitionsContainers();
}
use of com.hazelcast.internal.locksupport.LockSupportService in project hazelcast by hazelcast.
the class DefaultRecordStore method clearLockStore.
private void clearLockStore() {
NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
LockSupportService lockService = nodeEngine.getServiceOrNull(LockSupportService.SERVICE_NAME);
if (lockService != null) {
ObjectNamespace namespace = MapService.getObjectNamespace(name);
lockService.clearLockStore(partitionId, namespace);
}
}
Aggregations