if (file.isFile()) { Path parentArchiveDir = new Path(baseArchiveDir, file.getName()); Collection<File> children = file.getChildren(); failures.addAll(resolveAndArchive(fs, parentArchiveDir, children, start));
String archiveStartTime) throws IOException { String filename = currentFile.getName(); Path archiveFile = new Path(archiveDir, filename); FileSystem fs = currentFile.getFileSystem(); success = currentFile.moveAndClose(archiveFile); } catch (FileNotFoundException fnfe) { LOG.warn("Failed to archive " + currentFile +
@Override public String toString() { return this.getClass().getSimpleName() + ", " + getPath().toString(); } }
String archiveStartTime) throws IOException { String filename = currentFile.getName(); Path archiveFile = new Path(archiveDir, filename); FileSystem fs = currentFile.getFileSystem(); success = currentFile.moveAndClose(archiveFile); } catch (IOException e) { LOG.warn("Failed to archive " + currentFile + " on try #" + i, e);
String archiveStartTime) throws IOException { String filename = currentFile.getName(); Path archiveFile = new Path(archiveDir, filename); FileSystem fs = currentFile.getFileSystem(); success = currentFile.moveAndClose(archiveFile); } catch (IOException e) { LOG.warn("Failed to archive file: " + currentFile + " on try #" + i, e);
if (file.isFile()) { Path parentArchiveDir = new Path(baseArchiveDir, file.getName()); Collection<File> children = file.getChildren(); failures.addAll(resolveAndArchive(fs, parentArchiveDir, children, start));
if (file.isFile()) { Path parentArchiveDir = new Path(baseArchiveDir, file.getName()); Collection<File> children = file.getChildren(); failures.addAll(resolveAndArchive(fs, parentArchiveDir, children, start));
/** * Simple delete of regular files from the {@link FileSystem}. * <p> * This method is a more generic implementation that the other deleteXXX * methods in this class, allowing more code reuse at the cost of a couple * more, short-lived objects (which should have minimum impact on the jvm). * @param fs {@link FileSystem} where the files live * @param files {@link Collection} of files to be deleted * @throws IOException if a file cannot be deleted. All files will be * attempted to deleted before throwing the exception, rather than * failing at the first file. */ private static void deleteFilesWithoutArchiving(Collection<File> files) throws IOException { List<IOException> errors = new ArrayList<IOException>(0); for (File file : files) { try { LOG.debug("Deleting region file:" + file); file.delete(); } catch (IOException e) { LOG.error("Failed to delete file:" + file); errors.add(e); } } if (errors.size() > 0) { throw MultipleIOException.createIOException(errors); } }
@Override public String toString() { return this.getClass() + ", file:" + getPath().toString(); } }
@Override public String toString() { return this.getClass() + ", file:" + getPath().toString(); } }
@Override public Path apply(File file) { return file == null ? null : file.getPath(); } };