code: @Override
      public void stop() {
          if (!HAConfiguration.isHAEnabled(configuration)) {
              LOG.info("HA is not enabled, no need to stop leader election service");
              return;
          }
          try {
              leaderLatch.close();
              curatorFactory.close();
          } catch (IOException e) {
              LOG.error("Error closing leader latch", e);
          }
      }
docs: Leave leader election process and clean up resources on shutting down.
  
  If Atlas High Availability configuration is disabled, this operation is a no-op.
  @throws AtlasException