use of com.hazelcast.map.impl.MapContainer 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.map.impl.MapContainer in project hazelcast by hazelcast.
the class EvictionChecker method checkEvictable.
public boolean checkEvictable(RecordStore recordStore) {
if (recordStore.size() == 0) {
return false;
}
String mapName = recordStore.getName();
MapContainer mapContainer = recordStore.getMapContainer();
MaxSizeConfig maxSizeConfig = mapContainer.getMapConfig().getMaxSizeConfig();
MaxSizeConfig.MaxSizePolicy maxSizePolicy = maxSizeConfig.getMaxSizePolicy();
switch(maxSizePolicy) {
case PER_NODE:
return checkPerNodeEviction(recordStore);
case PER_PARTITION:
int partitionId = recordStore.getPartitionId();
return checkPerPartitionEviction(mapName, maxSizeConfig, partitionId);
case USED_HEAP_PERCENTAGE:
return checkHeapPercentageEviction(mapName, maxSizeConfig);
case USED_HEAP_SIZE:
return checkHeapSizeEviction(mapName, maxSizeConfig);
case FREE_HEAP_PERCENTAGE:
return checkFreeHeapPercentageEviction(maxSizeConfig);
case FREE_HEAP_SIZE:
return checkFreeHeapSizeEviction(maxSizeConfig);
default:
throw new IllegalArgumentException("Not an appropriate max size policy [" + maxSizePolicy + ']');
}
}
use of com.hazelcast.map.impl.MapContainer in project hazelcast by hazelcast.
the class EntryBackupOperation method publishWanReplicationEvent.
private void publishWanReplicationEvent(EntryEventType eventType) {
final MapContainer mapContainer = this.mapContainer;
if (!mapContainer.isWanReplicationEnabled()) {
return;
}
final MapEventPublisher mapEventPublisher = mapContainer.getMapServiceContext().getMapEventPublisher();
final Data key = dataKey;
if (EntryEventType.REMOVED == eventType) {
mapEventPublisher.publishWanReplicationRemoveBackup(name, key, Clock.currentTimeMillis());
} else {
final Record record = recordStore.getRecord(key);
if (record != null) {
dataValue = mapContainer.getMapServiceContext().toData(dataValue);
final EntryView entryView = createSimpleEntryView(key, dataValue, record);
mapEventPublisher.publishWanReplicationUpdateBackup(name, entryView);
}
}
}
use of com.hazelcast.map.impl.MapContainer in project hazelcast by hazelcast.
the class EntryOperation method publishWanReplicationEvent.
private void publishWanReplicationEvent() {
final MapContainer mapContainer = this.mapContainer;
if (mapContainer.getWanReplicationPublisher() == null && mapContainer.getWanMergePolicy() == null) {
return;
}
final Data key = dataKey;
if (REMOVED.equals(eventType)) {
mapEventPublisher.publishWanReplicationRemove(name, key, getNow());
} else {
final Record record = recordStore.getRecord(key);
if (record != null) {
dataValue = toData(dataValue);
final EntryView entryView = createSimpleEntryView(key, dataValue, record);
mapEventPublisher.publishWanReplicationUpdate(name, entryView);
}
}
}
use of com.hazelcast.map.impl.MapContainer in project hazelcast by hazelcast.
the class MapEventPublisherImpl method publishWanReplicationEventInternal.
protected void publishWanReplicationEventInternal(String mapName, ReplicationEventObject event) {
MapContainer mapContainer = mapServiceContext.getMapContainer(mapName);
WanReplicationPublisher wanReplicationPublisher = mapContainer.getWanReplicationPublisher();
wanReplicationPublisher.publishReplicationEvent(SERVICE_NAME, event);
}
Aggregations