public synchronized void stopScheduler() {
    if (isShuttingDown) {
      LOG.debug("Debounce timer shutdown is already in progress!");
      return;
    }

    isShuttingDown = true;
    LOG.info("Shutting down debounce timer!");

    // changing it back to use shutdown instead to prevent interruptions on the active task
    scheduledExecutorService.shutdown();

    // should clear out the future handles as well
    cancelAllScheduledActions();
  }
Stops the scheduler. After this invocation no further schedule calls will be accepted
and all pending enqueued tasks will be cancelled.
samza-core/src/main/java/org/apache/samza/zk/ScheduleAfterDebounceTime.java