Class AsyncBinaryStore.QueueDaemon

    • Constructor Detail

      • QueueDaemon

        public QueueDaemon()
        Construct a queue daemon to process pending writes.
    • Method Detail

      • scheduleWork

        public void scheduleWork()
        Notify the daemon that there is work to be done.
      • wakeNow

        public void wakeNow()
        Force the daemon to wake up immediately.
      • isDone

        public boolean isDone()
        Determine if the daemon thread should continue processing or should shut itself down. The daemon thread will continue processing as long as there is an underlying BinaryStore to write pending items to and the write-behind mode has not explicitly been disabled.
        Returns:
        true if the daemon should shut itself down
      • run

        public void run()
        This method is invoked on the daemon thread and performs the daemon processing until the thread stops.
        Specified by:
        run in interface Runnable
        Specified by:
        run in class Daemon
      • processPending

        protected void processPending​(Binary binKey,
                                      Binary binValue)
        Store the specified value under the specific key in the underlying store, or if the value is AsyncBinaryStore.DELETED then erase the value from the underlying store.
        Parameters:
        binKey - key to store the value under
        binValue - value to be stored
      • takeBreak

        protected void takeBreak()
        Take a short break before plowing into the pending work again. This mode is used when there is already more work to do.
      • takeNap

        protected void takeNap()
        Take a nap before checking for more pending work. This mode is purposefully relaxed to let some work queue up before trying to process it.
      • takeVacation

        protected void takeVacation()
        Go on an extended vacation until there is any pending work. This is called a "dormant" mode in which this thread will go to sleep indefinitely and require another thread to wake it up should any work need to be done.
      • isDormant

        protected boolean isDormant()
        Determine whether the daemon is dormant or not.
        Returns:
        true if the daemon is dormant, which means that the daemon must be woken up in order to do any work
      • setDormant

        protected void setDormant​(boolean fDormant)
        Specify whether the daemon is dormant or not.
        Parameters:
        fDormant - pass true if the daemon is going dormant, or false if the daemon is waking up from a dormant state