Class FileSaveTransactionRunnable


  • public class FileSaveTransactionRunnable
    extends StartableTransactionRunnable<TransactionRunnable>
    A TransactionRunnable for saving a file safely. The operation can be rolled back even after the onCommit() function is called. It is only final when the onComplete function is called.
    Since:
    3.0M2
    Version:
    $Id: a1874a06e50243651cbbe8cb6f0dac32bdd85e88 $
    • Constructor Detail

      • FileSaveTransactionRunnable

        public FileSaveTransactionRunnable​(File toSave,
                                           File tempFile,
                                           File backupFile,
                                           ReadWriteLock lock,
                                           StreamProvider provider)
        The Constructor.
        Parameters:
        toSave - the file to put the content in.
        tempFile - a temporary file, this should not contain anything important as it will be deleted and must not be altered while the operation is running. This will contain the data until onCommit when it is renamed to the toSave file.
        backupFile - a temporary file, this should not contain anything important as it will be deleted and must not be altered while the operation is running. This will contain whatever was in the toSave file prior, just in case onRollback must be called.
        lock - a ReadWriteLock whose writeLock will be locked as the beginning of the process and unlocked when complete.
        provider - a StreamProvider to get the data to put into the file.
      • FileSaveTransactionRunnable

        public FileSaveTransactionRunnable​(File toSave,
                                           File tempFile,
                                           File backupFile,
                                           ReadWriteLock lock,
                                           FileSerializer serializer)
        The Constructor.
        Parameters:
        toSave - the file to put the content in.
        tempFile - a temporary file, this should not contain anything important as it will be deleted and must not be altered while the operation is running. This will contain the data until onCommit when it is renamed to the toSave file.
        backupFile - a temporary file, this should not contain anything important as it will be deleted and must not be altered while the operation is running. This will contain whatever was in the toSave file prior, just in case onRollback must be called.
        lock - a ReadWriteLock whose writeLock will be locked as the beginning of the process and unlocked when complete.
        serializer - a FileSerializer in charge to serializing what need to be serialize to the file.
        Since:
        9.0RC1