public LocalMapStatsImpl createLocalMapStats(String mapName) { MapContainer mapContainer = mapServiceContext.getMapContainer(mapName); LocalMapStatsImpl stats = getLocalMapStatsImpl(mapName); if (!mapContainer.getMapConfig().isStatisticsEnabled()) { return stats; } int backupCount = mapContainer.getTotalBackupCount(); Address thisAddress = clusterService.getThisAddress(); LocalMapOnDemandCalculatedStats onDemandStats = new LocalMapOnDemandCalculatedStats(); onDemandStats.setBackupCount(backupCount); addNearCacheStats(stats, onDemandStats, mapContainer); for (int partitionId = 0; partitionId < partitionService.getPartitionCount(); partitionId++) { InternalPartition partition = partitionService.getPartition(partitionId); Address owner = partition.getOwnerOrNull(); if (owner == null) { // no-op because no owner is set yet. Therefore we don't know anything about the map continue; } if (owner.equals(thisAddress)) { addOwnerPartitionStats(stats, onDemandStats, mapName, partitionId); } else { addReplicaPartitionStats( onDemandStats, mapName, partitionId, partition, partitionService, backupCount, thisAddress); } } onDemandStats.copyValuesTo(stats); return stats; }