private String getHostName() {
    try {
      return InetAddress.getLocalHost().getHostName();
    } catch (UnknownHostException e) {
      LOG.error("Failed to fetch hostname of the processor", e);
      throw new SamzaException(e);
    }
  }
<p>
An implementation of Leader Elector using Zookeeper.

Each participant in the leader election process creates an instance of this class and tries to become the leader.
The participant with the lowest sequence number in the ZK subtree for election becomes the leader. Every non-leader
sets a watcher on its predecessor, where the predecessor is the participant with the largest sequence number
that is less than the current participant's sequence number.
</p>
samza-core/src/main/java/org/apache/samza/zk/ZkLeaderElector.java