Package com.nt.udc.util.state
Class StateSaverQueue
java.lang.Object
com.nt.udc.util.state.StateSaverQueue
- All Implemented Interfaces:
Runnable
This class implements a asynchronous state saving thread, and a
manager of state save requests. The class spins in its own thread,
processing requests that are queued up. If no requests exist, it
will go back to sleep, and then check later. This happens until
the class is shutdown.
-
Constructor Summary
ConstructorsConstructorDescriptionStateSaverQueue
(IntegerCallback saveFinishedCallback, LoggerIfc logger, Object stateLock, TimedStateMerger stateMerger, StateFreezer stateFreezer, AsynchronousStateSaver stateSaver) Constructs a StateSaverThread. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addStateRequest
(Callback requestor) Adds a save state request to the queue.void
run()
Run method for the state saving Thread.void
shutdown()
Stops the state saving Thread.
-
Constructor Details
-
StateSaverQueue
public StateSaverQueue(IntegerCallback saveFinishedCallback, LoggerIfc logger, Object stateLock, TimedStateMerger stateMerger, StateFreezer stateFreezer, AsynchronousStateSaver stateSaver) Constructs a StateSaverThread.- Parameters:
saveFinishedCallback
- Callback to an Object when all save state processing has finished, and normal processing has resumed. The number of processed requests is returned to the callback.logger
- Logger for errors and warnings.stateLock
- Insures no 2 save state routines occur at the same time.stateMerger
- Used to notify that a new state has been created, and merging should be done.stateFreezer
- Used to freeze the processing in the system.stateSaver
- Used for the actual save state routines.
-
-
Method Details
-
shutdown
public void shutdown()Stops the state saving Thread. -
addStateRequest
Adds a save state request to the queue.- Parameters:
requestor
- Callback to the Object that initiated the save state request. This callback is made when the state has been save successfully, but before the system has resumed processing.
-
run
public void run()Run method for the state saving Thread.
-