Class StateFreezer

java.lang.Object
com.nt.udc.util.state.StateFreezer
All Implemented Interfaces:
IntegerCallback

public class StateFreezer extends Object implements 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 Details

    • StateFreezer

      public StateFreezer(LoggerIfc logger)
      Creates a StateFreezer Object.
      Parameters:
      logger - Logger for errors and warnings.
  • Method Details

    • manageActiveObject

      public void manageActiveObject(StateFreezable activeObject)
      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

      public void freezeObjects() throws StateException
      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 interface IntegerCallback
      Parameters:
      id - The id of the element calling back.
    • unfreezeObjects

      public void unfreezeObjects() throws StateException
      This method unfreezes all the registered "active" objects.
      Throws:
      StateException