Class SingleResultWorker

java.lang.Object
com.aoindustries.noc.monitor.SingleResultWorker
All Implemented Interfaces:
Runnable

public abstract class SingleResultWorker extends Object implements Runnable
The workers for single results node.

TODO: Add persistence of the last report

Author:
AO Industries, Inc.
  • Field Details

    • persistenceFile

      protected final File persistenceFile
  • Constructor Details

    • SingleResultWorker

      protected SingleResultWorker(File persistenceFile)
  • Method Details

    • getNextStartupDelay

      protected int getNextStartupDelay()
      The default startup delay is within five minutes.
    • isIncrementalRampUp

      protected boolean isIncrementalRampUp(boolean isError)
      Enables incremental alert level ramp-up, where the node's alert level is only incremented one step at a time per monitoring pass. This makes the resource more tolerant of intermittent problems, at the cost of slower reaction time.

      Implementation Note:
      Enabled by default

      See Also:
    • run

      public final void run()
      Specified by:
      run in interface Runnable
    • getSleepDelay

      protected long getSleepDelay(boolean lastSuccessful, AlertLevel alertLevel)
      The default sleep delay is five minutes when successful or one minute when unsuccessful.
      Parameters:
      alertLevel - When null, treated as AlertLevel.UNKNOWN
    • getAlertLevelAndMessage

      protected abstract AlertLevelAndMessage getAlertLevelAndMessage(AlertLevel curAlertLevel, SingleResult result)
      Determines the alert level and message for the provided result.
    • getReport

      protected abstract String getReport() throws Exception
      Gets the report for this worker.
      Throws:
      Exception
    • cancel

      protected void cancel(Future<String> future)
      Cancels the current getReport call on a best-effort basis. Implementations of this method must not block. This default implementation calls future.cancel(true).