Package org.duracloud.sync.backup
Class ChangedListBackupManager
java.lang.Object
org.duracloud.sync.backup.ChangedListBackupManager
- All Implemented Interfaces:
Runnable
Manages the backing up of the changed list on a consistent schedule.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionChangedListBackupManager(ChangedList changedList, File backupDir, long backupFrequency, List<File> contentDirs) -
Method Summary
-
Field Details
-
SAVED_BACKUPS
public static final int SAVED_BACKUPS- See Also:
-
DEFAULT_SLEEP_TIME
protected static final int DEFAULT_SLEEP_TIME- See Also:
-
-
Constructor Details
-
ChangedListBackupManager
public ChangedListBackupManager(ChangedList changedList, File backupDir, long backupFrequency, List<File> contentDirs)
-
-
Method Details
-
loadBackup
public long loadBackup()Attempts to reload the changed list from a backup file. If there are no backup files or the backup file cannot be read, returns -1, otherwise the backup file is loaded and the time the backup file was written is returned.- Returns:
- the write time of the backup file, or -1 if no backup is available
-
run
public void run()Runs the backup manager. Writes out files which are a backups of the changed list based on the set backup frequency. Retains SAVED_BACKUPS number of backup files, removes the rest. -
sleep
protected void sleep(long milliseconds) -
clear
public void clear() -
endBackup
public void endBackup() -
hasBackups
public boolean hasBackups()
-