Search in sources :

Example 6 with PartitionContainer

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();
        }
    }
}
Also used : PartitionContainer(com.hazelcast.map.impl.PartitionContainer) RecordStore(com.hazelcast.map.impl.recordstore.RecordStore) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 7 with PartitionContainer

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;
}
Also used : PartitionContainer(com.hazelcast.map.impl.PartitionContainer)

Example 8 with PartitionContainer

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;
}
Also used : MapNearCacheManager(com.hazelcast.map.impl.nearcache.MapNearCacheManager) PartitionContainer(com.hazelcast.map.impl.PartitionContainer) NearCacheStats(com.hazelcast.monitor.NearCacheStats) NearCache(com.hazelcast.internal.nearcache.NearCache) MapContainer(com.hazelcast.map.impl.MapContainer)

Example 9 with PartitionContainer

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);
    }
}
Also used : PartitionContainer(com.hazelcast.map.impl.PartitionContainer)

Example 10 with PartitionContainer

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);
}
Also used : PartitionContainer(com.hazelcast.map.impl.PartitionContainer) RecordStore(com.hazelcast.map.impl.recordstore.RecordStore) IPartition(com.hazelcast.spi.partition.IPartition)

Aggregations

PartitionContainer (com.hazelcast.map.impl.PartitionContainer)11 RecordStore (com.hazelcast.map.impl.recordstore.RecordStore)6 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)5 MapService (com.hazelcast.map.impl.MapService)4 MapContainer (com.hazelcast.map.impl.MapContainer)3 MapProxyImpl (com.hazelcast.map.impl.proxy.MapProxyImpl)2 NearCache (com.hazelcast.internal.nearcache.NearCache)1 EntryCostEstimator (com.hazelcast.map.impl.EntryCostEstimator)1 MapNearCacheManager (com.hazelcast.map.impl.nearcache.MapNearCacheManager)1 Record (com.hazelcast.map.impl.record.Record)1 DefaultRecordStore (com.hazelcast.map.impl.recordstore.DefaultRecordStore)1 NearCacheStats (com.hazelcast.monitor.NearCacheStats)1 Address (com.hazelcast.nio.Address)1 Data (com.hazelcast.nio.serialization.Data)1 PagingPredicate (com.hazelcast.query.PagingPredicate)1 PagingPredicateAccessor.getNearestAnchorEntry (com.hazelcast.query.PagingPredicateAccessor.getNearestAnchorEntry)1 CachedQueryEntry (com.hazelcast.query.impl.CachedQueryEntry)1 QueryableEntry (com.hazelcast.query.impl.QueryableEntry)1 Extractors (com.hazelcast.query.impl.getters.Extractors)1 NodeEngine (com.hazelcast.spi.NodeEngine)1