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();
}
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"));
}
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());
}
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);
}
}
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);
}
Aggregations