Class CommitLogUtil


  • public final class CommitLogUtil
    extends Object
    Utility class used by the CommitLogProcessor to compare/delete commit log files.
    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • FILENAME_REGEX_PATTERN

        private static final Pattern FILENAME_REGEX_PATTERN
    • Constructor Detail

      • CommitLogUtil

        private CommitLogUtil()
    • Method Detail

      • moveCommitLog

        public static boolean moveCommitLog​(File file,
                                            Path toDir)
        Move a commit log to a new directory. If the commit log already exists in the new directory, it woull be replaced.
      • deleteCommitLog

        public static boolean deleteCommitLog​(File file)
        Delete a commit log and logs the error in the case the deletion failed.
      • getCommitLogs

        public static File[] getCommitLogs​(File directory)
        Given a directory, return an array of commit logs in this directory. If the directory does not contain any commit logs, an empty array is returned.
      • compareCommitLogs

        public static int compareCommitLogs​(File file1,
                                            File file2)
        Comparing two commit log files provided the File instances; Returns 0 if they are the same, -1 if first file is older, 1 if first file is newer.
      • compareCommitLogs

        public static int compareCommitLogs​(String filename1,
                                            String filename2)
        Comparing two commit log files provided the file names. Returns 0 if they are the same, -1 if first file is older, 1 if first file is newer.
      • extractTimestamp

        private static long extractTimestamp​(String commitLogFileName)