void registerLeaderLatchListener(final LeaderLatchListener latchListener, final ExecutorService executorService) {
    registeredListeners.put(latchListener, executorService);
    if (executorService == null) {
      leaderLatch.addListener(latchListener);
    } else {
      leaderLatch.addListener(latchListener, executorService);
    }
  }
If leadership related notifications is desired, use this method to register leader latch listener.

@param latchListener   - listener
@param executorService - event handler executor service
service/src/java/org/apache/hive/service/server/HS2ActivePassiveHARegistry.java