@Override
  public void afterPropertiesSet() throws Exception {

    JobClientProperties properties = null;
    if (locations == null || locations.length == 0) {
      properties = new JobClientProperties();
      properties.setUseRetryClient(useRetryClient);
      properties.setClusterName(clusterName);
      properties.setDataPath(dataPath);
      properties.setNodeGroup(nodeGroup);
      properties.setRegistryAddress(registryAddress);
      properties.setBindIp(bindIp);
      properties.setIdentity(identity);
      properties.setConfigs(CollectionUtils.toMap(configs));

    } else {
      properties =
          PropertiesConfigurationFactory.createPropertiesConfiguration(
              JobClientProperties.class, locations);
    }

    jobClient = JobClientBuilder.buildByProperties(properties);

    if (jobCompletedHandler != null) {
      jobClient.setJobCompletedHandler(jobCompletedHandler);
    }

    if (masterChangeListeners != null) {
      for (MasterChangeListener masterChangeListener : masterChangeListeners) {
        jobClient.addMasterChangeListener(masterChangeListener);
      }
    }
  }
  @SuppressWarnings("unchecked")
  @Override
  public void afterPropertiesSet() throws Exception {

    TaskTrackerProperties properties = null;
    if (locations == null || locations.length == 0) {
      properties = new TaskTrackerProperties();
      properties.setClusterName(clusterName);
      properties.setDataPath(dataPath);
      properties.setNodeGroup(nodeGroup);
      properties.setRegistryAddress(registryAddress);
      properties.setBindIp(bindIp);
      properties.setIdentity(identity);
      properties.setWorkThreads(workThreads);
      properties.setConfigs(CollectionUtils.toMap(configs));
      properties.setBizLoggerLevel(bizLoggerLevel);
    } else {
      properties =
          PropertiesConfigurationFactory.createPropertiesConfiguration(
              TaskTrackerProperties.class, locations);
    }

    taskTracker = TaskTrackerBuilder.buildByProperties(properties);

    registerRunnerBeanDefinition();

    // 设置config
    for (Map.Entry<Object, Object> entry : configs.entrySet()) {
      taskTracker.addConfig(entry.getKey().toString(), entry.getValue().toString());
    }

    taskTracker.setRunnerFactory(
        new RunnerFactory() {
          @Override
          public JobRunner newRunner() {
            return (JobRunner) applicationContext.getBean(jobRunnerBeanName);
          }
        });

    if (masterChangeListeners != null) {
      for (MasterChangeListener masterChangeListener : masterChangeListeners) {
        taskTracker.addMasterChangeListener(masterChangeListener);
      }
    }
  }