com.atomikos.persistence
Interface StateRecoverable<T>

All Superinterfaces:
FSMPreEnterEventSource<T>, Identifiable, Recoverable, Stateful<T>
All Known Implementing Classes:
CoordinatorImp

public interface StateRecoverable<T>
extends Recoverable, FSMPreEnterEventSource<T>

A type of stateful objects whose state is guaranteed to be recoverable. The logging is done based on PreEnter events. The guarantee offered is the following: IF a recoverable state is reached by the instance, then its image is GUARANTEED to be recoverable. The inverse does NOT hold: the fact that an object is recovered in some state does NOT mean that the state was reached. Indeed, other PreEnter listeners may still have prevented the transition in the last moment. However, this should not be a real problem; applications should take this into account.


Method Summary
 T[] getFinalStates()
          Needed by the Recovery system to determine when a logged state can be forgotten.
 ObjectImage getObjectImage(T state)
          Get an object image for the given state.
 T[] getRecoverableStates()
          Get the states that should be recoverable.
 
Methods inherited from interface com.atomikos.persistence.Recoverable
getObjectImage
 
Methods inherited from interface com.atomikos.util.Identifiable
getId
 
Methods inherited from interface com.atomikos.finitestates.FSMPreEnterEventSource
addFSMPreEnterListener
 
Methods inherited from interface com.atomikos.finitestates.Stateful
getState
 

Method Detail

getRecoverableStates

T[] getRecoverableStates()
Get the states that should be recoverable.

Returns:
Object[] An array of states that are meant to be recoverable. For efficiency, this should also include a state where the logimage is forgettable!

getFinalStates

T[] getFinalStates()
Needed by the Recovery system to determine when a logged state can be forgotten. If the instance reaches one of these states, then it will no longer be recoverable.

Returns:
Object[] The list of final states.

getObjectImage

ObjectImage getObjectImage(T state)
Get an object image for the given state.

Parameters:
state - The state about to be reached. Because the instance is not yet IN the new state, this state is supplied as a parameter.
Returns:
ObjectImage The image, or null to override the recoverability preference. In other words, if null is returned that logging is not done for the given state, even if the state was returned as one of the recoverable states.


Copyright © 2014. All Rights Reserved.