Search in sources :

Example 6 with LockSupportService

use of com.hazelcast.internal.locksupport.LockSupportService in project hazelcast by hazelcast.

the class AbstractRecordStore method createLockStore.

protected LockStore createLockStore() {
    NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
    LockSupportService lockService = nodeEngine.getServiceOrNull(LockSupportService.SERVICE_NAME);
    if (lockService == null) {
        return null;
    }
    return lockService.createLockStore(partitionId, MapService.getObjectNamespace(name));
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) LockSupportService(com.hazelcast.internal.locksupport.LockSupportService)

Example 7 with LockSupportService

use of com.hazelcast.internal.locksupport.LockSupportService in project hazelcast by hazelcast.

the class MultiMapContainer method destroy.

public void destroy() {
    LockSupportService lockService = nodeEngine.getServiceOrNull(LockSupportService.SERVICE_NAME);
    if (lockService != null) {
        lockService.clearLockStore(partitionId, lockNamespace);
    }
    multiMapValues.clear();
}
Also used : LockSupportService(com.hazelcast.internal.locksupport.LockSupportService)

Example 8 with LockSupportService

use of com.hazelcast.internal.locksupport.LockSupportService in project hazelcast by hazelcast.

the class MultiMapService method init.

@Override
public void init(final NodeEngine nodeEngine, Properties properties) {
    LockSupportService lockService = nodeEngine.getServiceOrNull(LockSupportService.SERVICE_NAME);
    if (lockService != null) {
        lockService.registerLockStoreConstructor(SERVICE_NAME, key -> {
            String name = key.getObjectName();
            final MultiMapConfig multiMapConfig = nodeEngine.getConfig().findMultiMapConfig(name);
            return new LockStoreInfo() {

                @Override
                public int getBackupCount() {
                    return multiMapConfig.getBackupCount();
                }

                @Override
                public int getAsyncBackupCount() {
                    return multiMapConfig.getAsyncBackupCount();
                }
            };
        });
    }
    boolean dsMetricsEnabled = nodeEngine.getProperties().getBoolean(ClusterProperty.METRICS_DATASTRUCTURES);
    if (dsMetricsEnabled) {
        ((NodeEngineImpl) nodeEngine).getMetricsRegistry().registerDynamicMetricsProvider(this);
    }
}
Also used : LockStoreInfo(com.hazelcast.internal.locksupport.LockStoreInfo) LockSupportService(com.hazelcast.internal.locksupport.LockSupportService) MultiMapConfig(com.hazelcast.config.MultiMapConfig) ConfigValidator.checkMultiMapConfig(com.hazelcast.internal.config.ConfigValidator.checkMultiMapConfig)

Aggregations

LockSupportService (com.hazelcast.internal.locksupport.LockSupportService)8 NodeEngine (com.hazelcast.spi.impl.NodeEngine)5 ObjectNamespace (com.hazelcast.internal.services.ObjectNamespace)2 Config (com.hazelcast.config.Config)1 MapStoreConfig (com.hazelcast.config.MapStoreConfig)1 MultiMapConfig (com.hazelcast.config.MultiMapConfig)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 ConfigValidator.checkMultiMapConfig (com.hazelcast.internal.config.ConfigValidator.checkMultiMapConfig)1 LockResource (com.hazelcast.internal.locksupport.LockResource)1 LockStoreInfo (com.hazelcast.internal.locksupport.LockStoreInfo)1 Data (com.hazelcast.internal.serialization.Data)1 DistributedObjectNamespace (com.hazelcast.internal.services.DistributedObjectNamespace)1 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)1 NightlyTest (com.hazelcast.test.annotation.NightlyTest)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 TransactionException (com.hazelcast.transaction.TransactionException)1 TransactionalMap (com.hazelcast.transaction.TransactionalMap)1 TransactionalTaskContext (com.hazelcast.transaction.TransactionalTaskContext)1 Test (org.junit.Test)1