@Override
  public ScheduledFuture scheduleTask() {
    return scheduler.scheduleWithFixedDelay(() -> {
      try {
        LOG.info("Checking for leader liveness");
        if (!checkIfLeaderAlive()) {
          listener.onStateChange();
        }
      } catch (Exception e) {
        errorHandler.accept("Exception in Leader Liveness Check Scheduler. Stopping the processor...");
      }
    }, LIVENESS_CHECK_DELAY_SEC, LIVENESS_CHECK_DELAY_SEC, TimeUnit.SECONDS);
  }
Scheduler class invoked by each processor to check if the leader is alive.
Checks every 30 seconds.
If a processor row hasn't been updated since 30 seconds, the system assumes that the processor has died.
All time units are in SECONDS.
samza-azure/src/main/java/org/apache/samza/coordinator/scheduler/LeaderLivenessCheckScheduler.java