code: synchronized void materializedJobSpec(Path jobSpecPath, JobSpec jobSpec, FileSystem fs)
        throws IOException, JobSpecNotFoundException {
      Path shadowDirectoryPath = new Path("/tmp");
      Path shadowFilePath = new Path(shadowDirectoryPath, UUID.randomUUID().toString());
      /* If previously existed, should delete anyway */
      if (fs.exists(shadowFilePath)) {
        fs.delete(shadowFilePath, false);
      }
  
      ImmutableMap.Builder mapBuilder = ImmutableMap.builder();
      mapBuilder.put(ImmutableFSJobCatalog.DESCRIPTION_KEY_IN_JOBSPEC, jobSpec.getDescription())
          .put(ImmutableFSJobCatalog.VERSION_KEY_IN_JOBSPEC, jobSpec.getVersion());
  
      if (jobSpec.getTemplateURI().isPresent()) {
        mapBuilder.put(ConfigurationKeys.JOB_TEMPLATE_PATH, jobSpec.getTemplateURI().get().toString());
      }
  
      Map<String, String> injectedKeys = mapBuilder.build();
      String renderedConfig = ConfigFactory.parseMap(injectedKeys).withFallback(jobSpec.getConfig())
          .root().render(ConfigRenderOptions.defaults());
      try (DataOutputStream os = fs.create(shadowFilePath);
          Writer writer = new OutputStreamWriter(os, Charsets.UTF_8)) {
        writer.write(renderedConfig);
      }
  
      /* (Optionally:Delete oldSpec) and copy the new one in. */
      if (fs.exists(jobSpecPath)) {
        if (! fs.delete(jobSpecPath, false)) {
          throw new IOException("Unable to delete existing job file: " + jobSpecPath);
        }
      }
      if (!fs.rename(shadowFilePath, jobSpecPath)) {
        throw new IOException("Unable to rename job file: " + shadowFilePath + " to " + jobSpecPath);
      }
    }
docs: Used for shadow copying in the process of updating a existing job configuration file,
  which requires deletion of the pre-existed copy of file and create a new one with the same name.
  Steps:
  Create a new one in /tmp.
  Safely deletion of old one.
  copy the newly created configuration file to jobConfigDir.
  Delete the shadow file.