Search in sources :

Example 16 with MapConfig

use of com.hazelcast.config.MapConfig in project hazelcast by hazelcast.

the class UpdateMapConfigOperation method run.

@Override
public void run() throws Exception {
    MapService service = getService();
    MapConfig oldConfig = service.getMapServiceContext().getMapContainer(mapName).getMapConfig();
    MapConfig newConfig = new MapConfig(oldConfig);
    newConfig.setTimeToLiveSeconds(mapConfig.getTimeToLiveSeconds());
    newConfig.setMaxIdleSeconds(mapConfig.getMaxIdleSeconds());
    newConfig.setEvictionPolicy(mapConfig.getEvictionPolicy());
    newConfig.setEvictionPercentage(mapConfig.getEvictionPercentage());
    newConfig.setMinEvictionCheckMillis(mapConfig.getMinEvictionCheckMillis());
    newConfig.setReadBackupData(mapConfig.isReadBackupData());
    newConfig.setBackupCount(mapConfig.getBackupCount());
    newConfig.setAsyncBackupCount(mapConfig.getAsyncBackupCount());
    newConfig.setMaxSizeConfig(mapConfig.getMaxSizeConfig());
    MapContainer mapContainer = service.getMapServiceContext().getMapContainer(mapName);
    mapContainer.setMapConfig(newConfig.getAsReadOnly());
    mapContainer.initEvictor();
}
Also used : MapConfig(com.hazelcast.config.MapConfig) MapService(com.hazelcast.map.impl.MapService) MapContainer(com.hazelcast.map.impl.MapContainer)

Example 17 with MapConfig

use of com.hazelcast.config.MapConfig in project hazelcast by hazelcast.

the class MapConfigDTO method fromJson.

@Override
public void fromJson(JsonObject json) {
    config = new MapConfig();
    config.setName(getString(json, "name"));
    config.setInMemoryFormat(InMemoryFormat.valueOf(getString(json, "memoryFormat")));
    config.setBackupCount(getInt(json, "backupCount"));
    config.setAsyncBackupCount(getInt(json, "asyncBackupCount"));
    config.setEvictionPercentage(getInt(json, "evictionPercentage"));
    config.setMinEvictionCheckMillis(getLong(json, "minEvictionCheckMillis"));
    config.setTimeToLiveSeconds(getInt(json, "ttl"));
    config.setMaxIdleSeconds(getInt(json, "maxIdle"));
    config.setMaxSizeConfig(new MaxSizeConfig().setSize(getInt(json, "maxSize")).setMaxSizePolicy(MaxSizeConfig.MaxSizePolicy.valueOf(getString(json, "maxSizePolicy"))));
    config.setReadBackupData(getBoolean(json, "readBackupData"));
    config.setEvictionPolicy(EvictionPolicy.valueOf(getString(json, "evictionPolicy")));
    config.setMergePolicy(getString(json, "mergePolicy"));
}
Also used : MaxSizeConfig(com.hazelcast.config.MaxSizeConfig) MapConfig(com.hazelcast.config.MapConfig)

Example 18 with MapConfig

use of com.hazelcast.config.MapConfig in project hazelcast by hazelcast.

the class MapConfigDTO method readData.

@Override
public void readData(ObjectDataInput in) throws IOException {
    config = new MapConfig();
    config.setName(in.readUTF());
    config.setInMemoryFormat(InMemoryFormat.valueOf(in.readUTF()));
    config.setBackupCount(in.readInt());
    config.setAsyncBackupCount(in.readInt());
    config.setEvictionPercentage(in.readInt());
    config.setMinEvictionCheckMillis(in.readLong());
    config.setTimeToLiveSeconds(in.readInt());
    config.setMaxIdleSeconds(in.readInt());
    config.setMaxSizeConfig(new MaxSizeConfig().setSize(in.readInt()).setMaxSizePolicy(MaxSizeConfig.MaxSizePolicy.valueOf(in.readUTF())));
    config.setReadBackupData(in.readBoolean());
    config.setEvictionPolicy(EvictionPolicy.valueOf(in.readUTF()));
    config.setMergePolicy(in.readUTF());
}
Also used : MaxSizeConfig(com.hazelcast.config.MaxSizeConfig) MapConfig(com.hazelcast.config.MapConfig)

Example 19 with MapConfig

use of com.hazelcast.config.MapConfig in project hazelcast by hazelcast.

the class MapRemoteService method createDistributedObject.

@Override
public DistributedObject createDistributedObject(String name) {
    MapConfig mapConfig = nodeEngine.getConfig().findMapConfig(name);
    checkMapConfig(mapConfig);
    if (mapConfig.isNearCacheEnabled()) {
        checkNearCacheConfig(name, mapConfig.getNearCacheConfig(), false);
        return new NearCachedMapProxyImpl(name, mapServiceContext.getService(), nodeEngine, mapConfig);
    } else {
        return new MapProxyImpl(name, mapServiceContext.getService(), nodeEngine, mapConfig);
    }
}
Also used : MapProxyImpl(com.hazelcast.map.impl.proxy.MapProxyImpl) NearCachedMapProxyImpl(com.hazelcast.map.impl.proxy.NearCachedMapProxyImpl) NearCachedMapProxyImpl(com.hazelcast.map.impl.proxy.NearCachedMapProxyImpl) MapConfig(com.hazelcast.config.MapConfig) ConfigValidator.checkMapConfig(com.hazelcast.internal.config.ConfigValidator.checkMapConfig)

Example 20 with MapConfig

use of com.hazelcast.config.MapConfig in project hazelcast by hazelcast.

the class EvictionChecker method calculatePerNodeMaxRecordStoreSize.

/**
     * Calculates and returns the expected maximum size of an evicted record-store
     * when {@link com.hazelcast.config.MaxSizeConfig.MaxSizePolicy#PER_NODE PER_NODE} max-size-policy is used.
     */
public double calculatePerNodeMaxRecordStoreSize(RecordStore recordStore) {
    MapConfig mapConfig = recordStore.getMapContainer().getMapConfig();
    MaxSizeConfig maxSizeConfig = mapConfig.getMaxSizeConfig();
    NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
    int configuredMaxSize = maxSizeConfig.getSize();
    int memberCount = nodeEngine.getClusterService().getSize(DATA_MEMBER_SELECTOR);
    int partitionCount = nodeEngine.getPartitionService().getPartitionCount();
    return (1D * configuredMaxSize * memberCount / partitionCount);
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) MaxSizeConfig(com.hazelcast.config.MaxSizeConfig) MapConfig(com.hazelcast.config.MapConfig)

Aggregations

MapConfig (com.hazelcast.config.MapConfig)178 Config (com.hazelcast.config.Config)123 HazelcastInstance (com.hazelcast.core.HazelcastInstance)78 Test (org.junit.Test)75 QuickTest (com.hazelcast.test.annotation.QuickTest)68 ParallelTest (com.hazelcast.test.annotation.ParallelTest)62 MapStoreConfig (com.hazelcast.config.MapStoreConfig)43 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)41 NearCacheConfig (com.hazelcast.config.NearCacheConfig)27 MaxSizeConfig (com.hazelcast.config.MaxSizeConfig)26 MapIndexConfig (com.hazelcast.config.MapIndexConfig)20 QuorumConfig (com.hazelcast.config.QuorumConfig)19 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)18 QueryCacheConfig (com.hazelcast.config.QueryCacheConfig)16 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)14 NightlyTest (com.hazelcast.test.annotation.NightlyTest)12 PartitionedCluster (com.hazelcast.quorum.PartitionedCluster)10 CountDownLatch (java.util.concurrent.CountDownLatch)10 BeforeClass (org.junit.BeforeClass)10 AssertTask (com.hazelcast.test.AssertTask)9