@Override
  public void tryBecomeLeader() throws AzureException {
    leaseId.getAndSet(leaseBlobManager.acquireLease(LEASE_TIME_IN_SEC, leaseId.get()));
    if (leaseId.get() != null) {
      LOG.info("Became leader with lease ID {}.", leaseId.get());
      isLeader.set(true);
      if (leaderElectorListener != null) {
        leaderElectorListener.onBecomingLeader();
      }
    } else {
      LOG.info("Unable to become the leader. Continuing as a worker.");
    }
  }
Tries to become the leader by acquiring a lease on the blob.
The acquireLease operation has a retry policy where upon failure, the operation is tried 3 times at 5 second intervals.
Invokes the listener on becoming the leader.
@throws AzureException If a Azure storage service error occurred. This includes the case where the blob you're trying to lease does not exist.
samza-azure/src/main/java/org/apache/samza/coordinator/AzureLeaderElector.java