Package com.nt.udc.util.state
Class SynchronousStateManager
java.lang.Object
com.nt.udc.util.state.StateManager
com.nt.udc.util.state.SynchronousStateManager
-
Field Summary
Fields inherited from class com.nt.udc.util.state.StateManager
activeObjArray, activeObjListenersArray, baseStateDir, logger, scratchDir, stateBufferFileName, stateBufferObjArray, stateDirObjArray -
Constructor Summary
ConstructorsConstructorDescriptionSynchronousStateManager(LoggerIfc logger, File scratchDir) Creates the default StateManagerSynchronousStateManager(LoggerIfc logger, File scratchDir, String stateBufferFileName) Creates the StateManager with a buffer file. -
Method Summary
Modifier and TypeMethodDescriptiongetType()Returns this type of StateManager.voidmanageState(StateBufferSaveable state) Adds a single StateBufferSaveable object to be managed.voidAdds a single StateDirectorySaveable object to be managed.voidmanageStates(StateBufferSaveable[] states) Adds an array of StateBufferSaveable objects for managing.voidmanageStates(StateDirectorySaveable[] states) Adds an array of StateDirectorySaveable objects for managing.voidThis method causes the state to be restored immediately.voidThis method causes the state to be saved immediately.voidThis method causes the state to be saved immediately.voidsetMergeThreshold(int threshold) Sets the number of state saves allowed before a merge occurs.voidsetStateBufferFileName(String stateBufferFileName) Sets the current state buffer file.voidshutdown()Shuts down the StateManager, and cleans up any remaining state-related files.Methods inherited from class com.nt.udc.util.state.StateManager
manageActiveObject
-
Constructor Details
-
SynchronousStateManager
Creates the default StateManager- Parameters:
logger- Activity loggerscratchDir- Directory which to store state data
-
SynchronousStateManager
Creates the StateManager with a buffer file.- Parameters:
logger- Activity loggerscratchDir- Directory which to store state data.stateBufferFileName- Buffer File name
-
-
Method Details
-
shutdown
public void shutdown()Shuts down the StateManager, and cleans up any remaining state-related files.- Overrides:
shutdownin classStateManager
-
setStateBufferFileName
Sets the current state buffer file.- Overrides:
setStateBufferFileNamein classStateManager- Parameters:
stateBufferFileName- Buffer file, containing the states.
-
manageState
Adds a single StateBufferSaveable object to be managed.- Overrides:
manageStatein classStateManager- Parameters:
stateDirObj- State object to manage
-
manageState
Adds a single StateDirectorySaveable object to be managed.- Overrides:
manageStatein classStateManager- Parameters:
stateDirObj- State object to manage
-
manageStates
Adds an array of StateBufferSaveable objects for managing.- Overrides:
manageStatesin classStateManager- Parameters:
states- Array of state objects
-
manageStates
Adds an array of StateDirectorySaveable objects for managing.- Overrides:
manageStatesin classStateManager- Parameters:
states- Array of state objects
-
setMergeThreshold
public void setMergeThreshold(int threshold) Sets the number of state saves allowed before a merge occurs. -
saveState
This method causes the state to be saved immediately.- Specified by:
saveStatein classStateManager- Throws:
StateException
-
saveState
This method causes the state to be saved immediately. The callback is not used.- Specified by:
saveStatein classStateManager- Throws:
StateException
-
restoreState
This method causes the state to be restored immediately.- Specified by:
restoreStatein classStateManager- Throws:
StateException
-
getType
Description copied from class:StateManagerReturns this type of StateManager.- Specified by:
getTypein classStateManager
-