public void stop() {
    if (this.started.compareAndSet(true, false)) {
      this.streamPartitionCountMonitor.ifPresent(StreamPartitionCountMonitor::stop);
      this.streamRegexMonitor.ifPresent(StreamRegexMonitor::stop);
    } else {
      LOG.warn("Monitors already stopped");
    }
  }
Utility class for managing multiple monitors.
samza-core/src/main/java/org/apache/samza/coordinator/JobModelMonitors.java