private void sampleStatistics() {
    SystemMemoryStatistics memoryStatistics = null;
    ProcessCPUStatistics cpuStatistics = null;
    try {
      memoryStatistics = statisticsGetter.getSystemMemoryStatistics();
      cpuStatistics = statisticsGetter.getProcessCPUStatistics();
    } catch (Throwable e) {
      LOG.error("Error during obtaining statistics: ", e);
    }
    SystemStatistics systemStatistics = new SystemStatistics(cpuStatistics, memoryStatistics);
    for (Listener listener : listenerSet.keySet()) {
      try {
        // catch all exceptions to shield one listener from exceptions thrown by others.
        listener.onUpdate(systemStatistics);
      } catch (Throwable e) {
        // delete this listener so that it does not receive future callbacks.
        listenerSet.remove(listener);
        LOG.error("Listener threw an exception: ", e);
      }
    }
  }
Creates a new {@link StatisticsMonitorImpl} that reports statistics periodically
@param pollingIntervalMillis The polling interval to report statistics.
@param statisticsGetter the getter to gather system stats info
samza-core/src/main/java/org/apache/samza/container/host/StatisticsMonitorImpl.java