Package org.jitsi.service.fileaccess
Interface FailSafeTransaction
-
- All Known Implementing Classes:
FailSafeTransactionImpl
public interface FailSafeTransactionA failsafe transaction interface. By failsafe we mean here that the file concerned always stays in a coherent state.- Author:
- Benoit Pradelle
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidbeginTransaction()Begins a new transaction.voidcommit()Closes the transaction and commit the changes.voidrestoreFile()Ensure that the file accessed is in a coherent state.voidrollback()Closes the transation and cancel the changes.
-
-
-
Method Detail
-
restoreFile
void restoreFile() throws IllegalStateException, IOExceptionEnsure that the file accessed is in a coherent state. This function is useful to do a failsafe read without starting a transaction.- Throws:
IllegalStateException- if the file doesn't exists anymoreIOException- if an IOException occurs during the file restoration
-
beginTransaction
void beginTransaction() throws IllegalStateException, IOExceptionBegins a new transaction. If a transaction is already active, commits the changes and begin a new transaction. A transaction can be closed by a commit or rollback operation. When the transaction begins, the file is restored to a coherent state if needed.- Throws:
IllegalStateException- if the file doesn't exists anymoreIOException- if an IOException occurs during the transaction creation
-
commit
void commit() throws IllegalStateException, IOExceptionCloses the transaction and commit the changes. Everything written in the file during the transaction is saved.- Throws:
IllegalStateException- if the file doesn't exists anymoreIOException- if an IOException occurs during the operation
-
rollback
void rollback() throws IllegalStateException, IOExceptionCloses the transation and cancel the changes. Everything written in the file during the transaction is NOT saved.- Throws:
IllegalStateException- if the file doesn't exists anymoreIOException- if an IOException occurs during the operation
-
-