Class FlashJournalRM.PreparerDaemon

  • All Implemented Interfaces:
    Guardable, Runnable
    Enclosing class:
    FlashJournalRM

    protected class FlashJournalRM.PreparerDaemon
    extends Daemon
    The PreparerDaemon takes the enqueued Binary values for the JournalFile objects, and lays them out in Buffer objects from the BufferPool, enqueuing them for the WriterDaemon to write.
    • Constructor Detail

      • PreparerDaemon

        public PreparerDaemon()
        Construct a PreparerDaemon.
    • Method Detail

      • instantiateWorker

        protected Daemon.DaemonWorker instantiateWorker()
        Instantiate a DaemonWorker that will be used as a daemon.
        Overrides:
        instantiateWorker in class Daemon
        Returns:
        a new instance of DaemonWorker or a sub-class thereof
      • run

        public void run()
        The daemon's implementation method. Override this method to implement a daemon.

        An example implementation is:

        
           while (!isStopping())
               {
               // do some processing
               // ...
        
               synchronized (this)
                   {
                   // wait for notification of more work
                   wait();
                   }
               }
         

        Specified by:
        run in interface Runnable
        Specified by:
        run in class Daemon
      • changeState

        protected void changeState​(int nState,
                                   Daemon.DaemonWorker worker)
        Change the state of the daemon.
        Overrides:
        changeState in class Daemon
        Parameters:
        nState - one of the STATE_enums
        worker - the new worker, if starting, otherwise the current worker
      • stop

        public void stop()
        Request the daemon to stop. This method will only have an effect if the daemon sub-class respects the value returned from Daemon.isStopping().
        Overrides:
        stop in class Daemon
      • notifyItemQueued

        public void notifyItemQueued​(FlashJournalRM.JournalFile jrnlfile,
                                     long lTicket)
        Notify the PreparerDaemon that an item has been queued to be written to the specified JournalFile.
        Parameters:
        jrnlfile - the JournalFile that is being appended to
        lTicket - the ticket for the item that was queued
      • notifyJournalFileFull

        public void notifyJournalFileFull​(FlashJournalRM.JournalFile jrnlfile)
        Notify the PreparerDaemon that the specified JournalFile has been cut off for new additions.
        Parameters:
        jrnlfile - the JournalFile that is now full