Search in sources :

Example 1 with LockStoreInfo

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

the class MultiMapService method init.

@Override
public void init(final NodeEngine nodeEngine, Properties properties) {
    int partitionCount = nodeEngine.getPartitionService().getPartitionCount();
    for (int partition = 0; partition < partitionCount; partition++) {
        partitionContainers[partition] = new MultiMapPartitionContainer(this, partition);
    }
    final LockService lockService = nodeEngine.getSharedService(LockService.SERVICE_NAME);
    if (lockService != null) {
        lockService.registerLockStoreConstructor(SERVICE_NAME, new ConstructorFunction<ObjectNamespace, LockStoreInfo>() {

            @Override
            public LockStoreInfo createNew(final ObjectNamespace key) {
                String name = key.getObjectName();
                final MultiMapConfig multiMapConfig = nodeEngine.getConfig().findMultiMapConfig(name);
                return new LockStoreInfo() {

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

                    @Override
                    public int getAsyncBackupCount() {
                        return multiMapConfig.getAsyncBackupCount();
                    }
                };
            }
        });
    }
}
Also used : LockStoreInfo(com.hazelcast.concurrent.lock.LockStoreInfo) LockService(com.hazelcast.concurrent.lock.LockService) MultiMapConfig(com.hazelcast.config.MultiMapConfig) ObjectNamespace(com.hazelcast.spi.ObjectNamespace) MigrationEndpoint(com.hazelcast.spi.partition.MigrationEndpoint)

Aggregations

LockService (com.hazelcast.concurrent.lock.LockService)1 LockStoreInfo (com.hazelcast.concurrent.lock.LockStoreInfo)1 MultiMapConfig (com.hazelcast.config.MultiMapConfig)1 ObjectNamespace (com.hazelcast.spi.ObjectNamespace)1 MigrationEndpoint (com.hazelcast.spi.partition.MigrationEndpoint)1