@Override
  public ScheduledFuture scheduleTask() {
    return scheduler.scheduleWithFixedDelay(() -> {
      try {
        LOG.info("Renewing lease");
        boolean status = leaseBlobManager.renewLease(leaseId.get());
        if (!status) {
          errorHandler.accept("Unable to renew lease. Continuing as non-leader.");
        }
      } catch (Exception e) {
        errorHandler.accept("Exception in Renew Lease Scheduler. Continuing as non-leader.");
      }
    }, RENEW_LEASE_DELAY_SEC, RENEW_LEASE_DELAY_SEC, TimeUnit.SECONDS);
  }
Scheduler class to keep renewing the lease once an entity has acquired it.
Renews every 45 seconds.
All time units are in SECONDS.
samza-azure/src/main/java/org/apache/samza/coordinator/scheduler/RenewLeaseScheduler.java