public static LeaderElection create(Configuration conf) throws IOException  {
    String method =
        MetastoreConf.getVar(conf, MetastoreConf.ConfVars.METASTORE_HOUSEKEEPING_LEADER_ELECTION);
    switch (method.toLowerCase()) {
      case "host":
        return new StaticLeaderElection();
      case "lock":
        return new LeaseLeaderElection();
      default:
        throw new UnsupportedOperationException(method + " is not supported for electing the leader");
    }
  }
Simple factory for creating the elector
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/leader/LeaderElectionFactory.java