use of com.hazelcast.map.impl.PartitionContainer in project hazelcast by hazelcast.
the class ClearExpiredOperation method run.
@Override
public void run() throws Exception {
final MapService mapService = getService();
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
final PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(getPartitionId());
final ConcurrentMap<String, RecordStore> recordStores = partitionContainer.getMaps();
final boolean backup = !isOwner();
for (final RecordStore recordStore : recordStores.values()) {
if (recordStore.size() > 0 && recordStore.isExpirable()) {
recordStore.evictExpiredEntries(expirationPercentage, backup);
recordStore.disposeDeferredBlocks();
}
}
}
use of com.hazelcast.map.impl.PartitionContainer in project hazelcast by hazelcast.
the class EvictionChecker method checkPerPartitionEviction.
protected boolean checkPerPartitionEviction(String mapName, MaxSizeConfig maxSizeConfig, int partitionId) {
final double maxSize = maxSizeConfig.getSize();
final PartitionContainer container = mapServiceContext.getPartitionContainer(partitionId);
if (container == null) {
return false;
}
final int size = getRecordStoreSize(mapName, container);
return size > maxSize;
}
use of com.hazelcast.map.impl.PartitionContainer in project hazelcast by hazelcast.
the class EvictionChecker method getUsedHeapInBytes.
protected long getUsedHeapInBytes(String mapName) {
long heapCost = 0L;
final List<Integer> partitionIds = findPartitionIds();
for (int partitionId : partitionIds) {
final PartitionContainer container = mapServiceContext.getPartitionContainer(partitionId);
if (container == null) {
continue;
}
heapCost += getRecordStoreHeapCost(mapName, container);
}
MapContainer mapContainer = mapServiceContext.getMapContainer(mapName);
if (!mapContainer.getMapConfig().isNearCacheEnabled()) {
return heapCost;
}
MapNearCacheManager mapNearCacheManager = mapServiceContext.getMapNearCacheManager();
NearCache nearCache = mapNearCacheManager.getNearCache(mapName);
NearCacheStats nearCacheStats = nearCache.getNearCacheStats();
heapCost += nearCacheStats.getOwnedEntryMemoryCost();
return heapCost;
}
use of com.hazelcast.map.impl.PartitionContainer in project hazelcast by hazelcast.
the class MapOperation method getRecordStoreOrNull.
private RecordStore getRecordStoreOrNull() {
int partitionId = getPartitionId();
if (partitionId == -1) {
return null;
}
PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId);
if (createRecordStoreOnDemand) {
return partitionContainer.getRecordStore(name);
} else {
return partitionContainer.getExistingRecordStore(name);
}
}
use of com.hazelcast.map.impl.PartitionContainer in project hazelcast by hazelcast.
the class MapProxySupport method readBackupDataOrNull.
private Data readBackupDataOrNull(Data key) {
int partitionId = partitionService.getPartitionId(key);
IPartition partition = partitionService.getPartition(partitionId, false);
if (!partition.isOwnerOrBackup(thisAddress)) {
return null;
}
PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId);
RecordStore recordStore = partitionContainer.getExistingRecordStore(name);
if (recordStore == null) {
return null;
}
return recordStore.readBackupData(key);
}
Aggregations