Class Maintainer

  • All Implemented Interfaces:
    java.lang.AutoCloseable, java.lang.Runnable

    public abstract class Maintainer
    extends java.lang.Object
    implements java.lang.Runnable, java.lang.AutoCloseable
    The base class for maintainers. A maintainer is some job which runs at a fixed rate to perform maintenance tasks.
    Author:
    bratseth, mpolden
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.logging.Logger log  
    • Constructor Summary

      Constructors 
      Constructor Description
      Maintainer​(java.lang.String name, java.time.Duration interval, java.time.Duration initialDelay, JobControl jobControl)  
      Maintainer​(java.lang.String name, java.time.Duration interval, java.time.Instant startedAt, JobControl jobControl, java.util.List<java.lang.String> clusterHostnames)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      protected java.time.Duration interval()
      Returns the interval at which this job is set to run
      void lockAndMaintain()
      Run this while holding the job lock
      protected abstract void maintain()
      Called once each time this maintenance job should run
      java.lang.String name()
      Returns the simple name of this job
      void run()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • log

        protected final java.util.logging.Logger log
    • Constructor Detail

      • Maintainer

        public Maintainer​(java.lang.String name,
                          java.time.Duration interval,
                          java.time.Instant startedAt,
                          JobControl jobControl,
                          java.util.List<java.lang.String> clusterHostnames)
      • Maintainer

        public Maintainer​(java.lang.String name,
                          java.time.Duration interval,
                          java.time.Duration initialDelay,
                          JobControl jobControl)
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • maintain

        protected abstract void maintain()
        Called once each time this maintenance job should run
      • interval

        protected java.time.Duration interval()
        Returns the interval at which this job is set to run
      • lockAndMaintain

        public final void lockAndMaintain()
        Run this while holding the job lock
      • name

        public final java.lang.String name()
        Returns the simple name of this job