Class AbstractJournalRM.CollectorDaemon

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

    protected class AbstractJournalRM.CollectorDaemon
    extends Daemon
    The CollectorDaemon evaluates the JournalFile objects to see which ones should be evacuated, it evacuates those that should be, and it deletes those that have been successfully evacuated.

    This daemon is not intended to be guarded.

    • Constructor Detail

      • CollectorDaemon

        public CollectorDaemon()
        Construct a CollectorDaemon.
    • 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
      • 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
      • 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
      • setGuardPolicy

        protected void setGuardPolicy​(Guardian guardian,
                                      long cTimeoutMillis,
                                      float flPctRecover)
        Set the Guardian and policy to guard this Daemon with. The Daemon is registered with the specified Guardian each time the Daemon is started, and is released each time the Daemon is stopped.
        Overrides:
        setGuardPolicy in class Daemon
        Parameters:
        guardian - the Guardian that will be guarding this Daemon
        cTimeoutMillis - the timeout in ms for this Daemon, or 0 for the service guardian timeout
        flPctRecover - the recovery percentage for this Daemon
      • getDescription

        protected String getDescription()
        Format the Daemon attributes into a String for inclusion in the String returned from the Daemon.toString() method.
        Overrides:
        getDescription in class Daemon
        Returns:
        a String listing the attributes of the Daemon
      • dedupe

        protected void dedupe()
        Give the in-memory radix key stores a chance to de-dupe their byte[] values, similar to the concept behind String's intern() method.
      • getReservedFileId

        protected int getReservedFileId()
        Return the currently reserved file id.
        Returns:
        the currently reserved file id