Class TimeSweeper

java.lang.Object
org.cip4.jdflib.util.thread.TimeSweeper
All Implemented Interfaces:
Sweeper

public class TimeSweeper extends Object implements Sweeper
class that sweeps at a regular interval - useful in case multiple sweepers with differing timing requirements are run
  • Field Details

    • log

      protected org.apache.commons.logging.Log log
    • t0

      protected long t0
    • nSweep

      protected long nSweep
    • runner

      protected Runnable runner
  • Constructor Details

    • TimeSweeper

      protected TimeSweeper(int interval)
      Parameters:
      interval - the time interval in seconds
    • TimeSweeper

      public TimeSweeper(int interval, Runnable runner)
      Parameters:
      interval - the time interval in seconds
      runner - the runnable to run
  • Method Details

    • setInterval

      public void setInterval(int interval)
      Parameters:
      interval - in seconds
    • setFirstInterval

      public void setFirstInterval(int interval)
      Parameters:
      interval - in seconds
    • getRunnerClass

      public Class<?> getRunnerClass()
      get the subclass or class of the runner
      Returns:
    • needSweep

      public boolean needSweep()
      if true we want to sweep
      Specified by:
      needSweep in interface Sweeper
      Returns:
      See Also:
    • sweep

      public boolean sweep()
      default is nop or runner.run
      Specified by:
      sweep in interface Sweeper
      Returns:
      true if all went well
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also: