private void createRuntimeConfigJar(Path dir, Map<String, LocalFile> localFiles, Path stagingDir) throws IOException { LOG.debug("Create and copy {}", Constants.Files.RUNTIME_CONFIG_JAR); // Jar everything under the given directory, which contains different files needed by AM/runnable containers Location location = Locations.toLocation(Files.createTempFile(stagingDir, Constants.Files.RUNTIME_CONFIG_JAR, null)); try ( JarOutputStream jarOutput = new JarOutputStream(location.getOutputStream()); DirectoryStream<Path> stream = Files.newDirectoryStream(dir) ) { for (Path path : stream) { JarEntry jarEntry = new JarEntry(path.getFileName().toString()); BasicFileAttributes attrs = Files.readAttributes(path, BasicFileAttributes.class); jarEntry.setSize(attrs.size()); jarEntry.setLastAccessTime(attrs.lastAccessTime()); jarEntry.setLastModifiedTime(attrs.lastModifiedTime()); jarOutput.putNextEntry(jarEntry); Files.copy(path, jarOutput); jarOutput.closeEntry(); } } LOG.debug("Done {}", Constants.Files.RUNTIME_CONFIG_JAR); localFiles.put(Constants.Files.RUNTIME_CONFIG_JAR, createLocalFile(Constants.Files.RUNTIME_CONFIG_JAR, location, true)); }
newEntry.setLastAccessTime(JarMerger.ZERO_TIME); newEntry.setCreationTime(JarMerger.ZERO_TIME);
private void createRuntimeConfigJar(Path dir, Map<String, LocalFile> localFiles, Path stagingDir) throws IOException { LOG.debug("Create and copy {}", Constants.Files.RUNTIME_CONFIG_JAR); // Jar everything under the given directory, which contains different files needed by AM/runnable containers Location location = Locations.toLocation(Files.createTempFile(stagingDir, Constants.Files.RUNTIME_CONFIG_JAR, null)); try ( JarOutputStream jarOutput = new JarOutputStream(location.getOutputStream()); DirectoryStream<Path> stream = Files.newDirectoryStream(dir) ) { for (Path path : stream) { JarEntry jarEntry = new JarEntry(path.getFileName().toString()); BasicFileAttributes attrs = Files.readAttributes(path, BasicFileAttributes.class); jarEntry.setSize(attrs.size()); jarEntry.setLastAccessTime(attrs.lastAccessTime()); jarEntry.setLastModifiedTime(attrs.lastModifiedTime()); jarOutput.putNextEntry(jarEntry); Files.copy(path, jarOutput); jarOutput.closeEntry(); } } LOG.debug("Done {}", Constants.Files.RUNTIME_CONFIG_JAR); localFiles.put(Constants.Files.RUNTIME_CONFIG_JAR, createLocalFile(Constants.Files.RUNTIME_CONFIG_JAR, location, true)); }
newEntry.setLastAccessTime(ZERO_TIME); newEntry.setCreationTime(ZERO_TIME);
jarEntry.setLastAccessTime(ZERO_TIME); jarEntry.setCreationTime(ZERO_TIME); jarOutputStream.putNextEntry(jarEntry);