private synchronized void loadStateStore()

in myriad-scheduler/src/main/java/org/apache/myriad/state/SchedulerState.java [394:419]


  private synchronized void loadStateStore() {
    if (this.stateStore == null) {
      LOGGER.debug("Could not load state from state store as HA is disabled");
      return;
    }

    try {
      StoreContext sc = stateStore.loadMyriadState();
      if (sc != null) {
        this.frameworkId = sc.getFrameworkId();
        this.tasks.putAll(sc.getTasks());
        convertToThis(TaskState.PENDING, sc.getPendingTasks());
        convertToThis(TaskState.STAGING, sc.getStagingTasks());
        convertToThis(TaskState.ACTIVE, sc.getActiveTasks());
        convertToThis(TaskState.LOST, sc.getLostTasks());
        convertToThis(TaskState.KILLABLE, sc.getKillableTasks());
        LOGGER.info("Loaded Myriad state from state store successfully.");
        LOGGER.debug("State Store state includes frameworkId: {}, pending tasks count: {}, staging tasks count: {} " +
                     "active tasks count: {}, lost tasks count: {}, and killable tasks count: {}", frameworkId.getValue(),
                      this.getPendingTaskIds().size(), this.getStagingTaskIds().size(), this.getActiveTaskIds().size(),
                      this.getLostTaskIds().size(), this.getKillableTaskIds().size());
      }
    } catch (Exception e) {
      LOGGER.error("Failed to read scheduler state from state store", e);
    }
  }