Class AbstractBackupStrategy

    • Constructor Detail

      • AbstractBackupStrategy

        public AbstractBackupStrategy()
    • Method Detail

      • getBackupFileName

        public java.lang.String getBackupFileName​(java.lang.String fileName,
                                                  int backupIndex)
        Description copied from interface: BackupStrategy2
        Get the backup file name for specific index.

        Generally, a backup file with normal file name 'log' and index 'n' could simply be 'log.bak.n', you can specify your own naming rules, by overriding this method.

        Make sure to return different backup file name with different backup index, and same backup file name with same index. Otherwise, it will lead to unexpected behavior.

        Specified by:
        getBackupFileName in interface BackupStrategy2
        Parameters:
        fileName - the normal file name, generated by FileNameGenerator.generateFileName(int, long)
        backupIndex - the backup index, which will increase from 1 to BackupStrategy2.getMaxBackupIndex()
        Returns:
        the backup file name