public List<MetastoreTaskThread> getRemoteOnlyTasks() throws Exception {
    List<MetastoreTaskThread> remoteOnlyTasks = new ArrayList<>();
    if(!MetastoreConf.getBoolVar(configuration,
        MetastoreConf.ConfVars.METASTORE_HOUSEKEEPING_THREADS_ON)) {
      return remoteOnlyTasks;
    }
    boolean isCompactorEnabled = MetastoreConf.getBoolVar(configuration, MetastoreConf.ConfVars.COMPACTOR_INITIATOR_ON)
            || MetastoreConf.getBoolVar(configuration, MetastoreConf.ConfVars.COMPACTOR_CLEANER_ON);

    Collection<String> taskNames =
        MetastoreConf.getStringCollection(configuration, MetastoreConf.ConfVars.TASK_THREADS_REMOTE_ONLY);
    for (String taskName : taskNames) {
      if (CompactionHouseKeeperService.class.getName().equals(taskName) && !isCompactorEnabled) {
        continue;
      }
      MetastoreTaskThread task =
          JavaUtils.newInstance(JavaUtils.getClass(taskName, MetastoreTaskThread.class));
      remoteOnlyTasks.add(task);
    }
    return remoteOnlyTasks;
  }
invoke setConf(Configuration conf) before running
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/leader/HouseKeepingTasks.java