Package com.nt.udc.util.state
Class StateFreezer
java.lang.Object
com.nt.udc.util.state.StateFreezer
- All Implemented Interfaces:
IntegerCallback
This class is responsible for freezing the state of the
appropriately registered StateFreezable Objects. Once the
Objects have been frozen, other routines may be
run with the guarantee that all data processing has been
halted. Typically, there will be at least one Object per
running thread that drives the processing, and needs
to be frozen.
As an example, if the state of a node needs saving, then
all running threads must be frozen so that the relavent
can be written to disk.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
callback
(int id) The callback method for the "freezeObjects()" method.void
This method freezes all the registered "active" objects.void
manageActiveObject
(StateFreezable activeObject) Manages a single active Object.void
This method unfreezes all the registered "active" objects.
-
Constructor Details
-
StateFreezer
Creates a StateFreezer Object.- Parameters:
logger
- Logger for errors and warnings.
-
-
Method Details
-
manageActiveObject
Manages a single active Object. This Object will be told to freeze before all state saving routines occur. Note that using this method implies that there are **NO** order dependencies related to the given Object.- Parameters:
activeObject
- Object to be frozen during state save
-
freezeObjects
This method freezes all the registered "active" objects.- Throws:
StateException
-
callback
public void callback(int id) The callback method for the "freezeObjects()" method.- Specified by:
callback
in interfaceIntegerCallback
- Parameters:
id
- The id of the element calling back.
-
unfreezeObjects
This method unfreezes all the registered "active" objects.- Throws:
StateException
-