qflib 0.98.0

de.qfs.lib.transaction
Interface StateHolder


public interface StateHolder

The StateHolder interface is used by CommitableStateChange to make the change of an Object's state part of a Transaction.

The StateHolder's saveState method is called by the constructor of the CommitableStateChange. Its return value can hold any kind of information that will be passed on to commitState or restoreState, e.g. the saved state itself or just a flag, whether the state was actually saved.

Since:
0.97.0
Version:
$Revision: 1.4 $
Author:
Gregor Schmid

Method Summary
 void commitState(java.lang.Object info)
          Commit the saved state of the StateHolder.
 void restoreState(java.lang.Object info)
          Restore the StateHolder's state.
 java.lang.Object saveState()
          Save the StateHolder's state.
 

Method Detail

saveState

public java.lang.Object saveState()
Save the StateHolder's state.
Returns:
Some information that is useful during commitState or restoreState.

commitState

public void commitState(java.lang.Object info)
                 throws FatalTransactionException
Commit the saved state of the StateHolder. Typically a noop.
Parameters:
info - The information returned from saveState.
Throws:
FatalTransactionException - If something fails in a way that corrupts the whole Transaction.

restoreState

public void restoreState(java.lang.Object info)
                  throws FatalTransactionException
Restore the StateHolder's state.
Parameters:
info - The information returned from saveState.
Throws:
FatalTransactionException - If something fails in a way that corrupts the whole Transaction.

qflib 0.98.0