private void sampleResources(List<MarkableSampleHandler> handlers) {
    final boolean isDebugEnabled_STATISTICS = logger.isTraceEnabled(LogMarker.STATISTICS_VERBOSE);
    if (isDebugEnabled_STATISTICS) {
      logger.trace(LogMarker.STATISTICS_VERBOSE, "SampleCollector#sampleResources handlers={}",
          handlers);
    }
    int newModCount = sampler.getStatisticsModCount();
    // TODO: what if one is deleted and one is added
    if (statResourcesModCount != newModCount) {
      statResourcesModCount = newModCount;
      int ignoreCount = 0;

      Statistics[] resources = sampler.getStatistics();
      for (Statistics statistics : resources) {
        // only notify marked/old handlers of new types or resources
        if (!resourceInstMap.containsKey(statistics)) {
          try {
            ResourceType type = getResourceType(handlers, statistics);
            ResourceInstance resource = allocateResourceInstance(type, statistics);
            notifyOldHandlersOfResource(handlers, resource);
          } catch (IgnoreResourceException ex) {
            ignoreCount++;
          }
        }
      }

      if (isDebugEnabled_STATISTICS) {
        logger.trace(LogMarker.STATISTICS_VERBOSE,
            "SampleCollector#sampleResources resources.length={}, ignoreCount={}", resources.length,
            ignoreCount);
      }
      List<ResourceInstance> ri = cleanupResources(resources, ignoreCount);
      notifyOldHandlers(handlers, ri);
    }

    // notify unmarked/new handlers but not marked/old handlers
    notifyNewHandlersOfResources(handlers, resourceTypeMap.values(),
        resourceInstMap.values());
  }
Detect and archive any new resource additions or deletions
geode-core/src/main/java/org/apache/geode/internal/statistics/SampleCollector.java