Package com.nt.udc.util.state
Class AsynchronousStateSaver
java.lang.Object
com.nt.udc.util.state.StateSaver
com.nt.udc.util.state.AsynchronousStateSaver
- All Implemented Interfaces:
IntegerCallback
The class will save the state of a set of registered Objects.
The saving is done asynchronously, in that a new Thread is
created for each call to save the Objects' state. Therefore, a
call to "saveState()" requests the state to be saved - it
does not guarantee the state will be saved within the time frame
of that call.
Also, all processing Objects are "frozen" will the
StateFreezer prior to saving the state.
-
Field Summary
Fields inherited from class com.nt.udc.util.state.StateSaver
baseStateDir, logger, stateBufferFileName, stateBufferObjArray, stateDirComp, stateDirGenerator, stateDirObjArray, tmpFilter
-
Constructor Summary
ConstructorsConstructorDescriptionAsynchronousStateSaver
(LoggerIfc logger, File baseStateDir, Object stateLock, StateFreezer freezer, TimedStateMerger stateMerger) Creates an AsynchronousStateSaver Object. -
Method Summary
Methods inherited from class com.nt.udc.util.state.StateSaver
saveState, setBufferArray, setDirArray, setStateBufferFileName
-
Constructor Details
-
AsynchronousStateSaver
public AsynchronousStateSaver(LoggerIfc logger, File baseStateDir, Object stateLock, StateFreezer freezer, TimedStateMerger stateMerger) Creates an AsynchronousStateSaver Object.- Parameters:
logger
- Logger for warnings and errors.baseStateDir
- Location of state sub-directories.stateLock
- Lock required to obtain before saving the state. This ensures no other state-related routines will be operating.freezer
- Used to freeze all processing Objects.stateMerger
- Used to merge the state directories.
-
-
Method Details
-
shutdown
public void shutdown()Stops the state saving Thread. -
saveState
Requests the state of the registered Objects to be saved, and returns immediately. A separate thread will actually call "saveState()" on the registered Objects. -
callback
public void callback(int callbackValue) Tells this Objects that a save state thread has completed.- Specified by:
callback
in interfaceIntegerCallback
-