@Override
 public final void beforeRun() throws Exception {
   mapService = getService();
   mapContainer = mapService.getMapServiceContext().getMapContainer(name);
   partitionContainer = mapService.getMapServiceContext().getPartitionContainer(getPartitionId());
   recordStore = partitionContainer.getRecordStore(name);
   innerBeforeRun();
 }
Beispiel #2
0
 private static long getUsedHeapSize(final MapContainer mapContainer) {
   long heapCost = 0L;
   final MapService mapService = mapContainer.getMapService();
   final String mapName = mapContainer.getName();
   final NodeEngine nodeEngine = mapService.getNodeEngine();
   final Address thisAddress = nodeEngine.getThisAddress();
   for (int i = 0; i < nodeEngine.getPartitionService().getPartitionCount(); i++) {
     if (nodeEngine.getPartitionService().getPartition(i).isOwnerOrBackup(thisAddress)) {
       final PartitionContainer container = mapService.getPartitionContainer(i);
       if (container == null) {
         return -1L;
       }
       heapCost += container.getRecordStore(mapName).getHeapCost();
     }
   }
   heapCost += mapContainer.getNearCacheSizeEstimator().getSize();
   return heapCost;
 }
Beispiel #3
0
 private static boolean isEvictablePerPartition(final MapContainer mapContainer) {
   final MapService mapService = mapContainer.getMapService();
   final MaxSizeConfig maxSizeConfig = mapContainer.getMapConfig().getMaxSizeConfig();
   final int maxSize = getApproximateMaxSize(maxSizeConfig.getSize());
   final String mapName = mapContainer.getName();
   final NodeEngine nodeEngine = mapService.getNodeEngine();
   final InternalPartitionService partitionService = nodeEngine.getPartitionService();
   for (int i = 0; i < partitionService.getPartitionCount(); i++) {
     final Address owner = partitionService.getPartitionOwner(i);
     if (nodeEngine.getThisAddress().equals(owner)) {
       final PartitionContainer container = mapService.getPartitionContainer(i);
       if (container == null) {
         return false;
       }
       final int size = container.getRecordStore(mapName).size();
       if (size >= maxSize) {
         return true;
       }
     }
   }
   return false;
 }