@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);
      }
    }
  }