Class ResetManager

  • Direct Known Subclasses:
    DeleteStartupResetManager, DocCleanupResetManager, DocDeleteResetManager, NotificationResetManager, SeedingResetManager, StartupResetManager, WorkerResetManager

    public abstract class ResetManager
    extends java.lang.Object
    The reset manager basically keeps track of threads that work together. If the threads get hosed as a result of problems, then certain resets need to be done. Each instance of this manager therefore tracks all the threads which depend or affect a condition that needs explicit resetting. When a thread recognizes that the database (or whatever resource) is potentially in a state where a reset for the particular condition is required, then the corresponding reset manager object will cause all dependent threads to block, until they are all accounted for. Then, the corrective reset is done, and the threads are released (with a signal corresponding to the fact that a reset occurred returned). This class is meant to be extended in order to implement the exact reset functionality required.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String _rcsid  
      protected int involvedThreadCount
      This is the count of the threads that care about this resource.
      protected java.lang.String processID
      Process ID
      protected boolean resetRequired
      Boolean which describes whether an event requiring reset has occurred.
      protected int waitingThreads
      This is the number of threads that are waiting for the reset.
    • Constructor Summary

      Constructors 
      Constructor Description
      ResetManager​(java.lang.String processID)
      Constructor.
    • Field Detail

      • processID

        protected final java.lang.String processID
        Process ID
      • resetRequired

        protected volatile boolean resetRequired
        Boolean which describes whether an event requiring reset has occurred.
      • involvedThreadCount

        protected int involvedThreadCount
        This is the count of the threads that care about this resource.
      • waitingThreads

        protected volatile int waitingThreads
        This is the number of threads that are waiting for the reset.
    • Constructor Detail

      • ResetManager

        public ResetManager​(java.lang.String processID)
        Constructor.
    • Method Detail

      • registerMe

        public void registerMe()
        Register a thread with this reset manager.
      • noteEvent

        public void noteEvent()
        Note a resettable event.
      • waitForReset

        public boolean waitForReset​(IThreadContext tc)
                             throws ManifoldCFException,
                                    java.lang.InterruptedException
        Enter "wait" state for current thread. This method is the main logic for the reset manager. A thread calls this method, which may block until all other threads are waiting too. Then, the reset method is called by exactly ONE of the waiting threads, and they all are released.
        Returns:
        false if no reset took place, or true if one did.
        Throws:
        ManifoldCFException
        java.lang.InterruptedException
      • performWakeupLogic

        protected abstract void performWakeupLogic()
        Do the wakeup logic.