Class TableResultWorker<R,D>

All Implemented Interfaces:

public abstract class TableResultWorker<R,D> extends Object implements Runnable
The workers for table results node.

TODO: Add persistence of the last report

AO Industries, Inc.
  • Field Details

    • persistenceFile

      protected final File persistenceFile
  • Constructor Details

    • TableResultWorker

      protected TableResultWorker(File persistenceFile)
  • Method Details

    • getAlertLevel

      public final AlertLevel getAlertLevel()
    • 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
    • getTimeout

      protected long getTimeout()
      Gets the timeout value. Defaults to 5.
    • getTimeoutUnit

      protected TimeUnit getTimeoutUnit()
      Gets the timeout time unit. Defaults to TimeUnit.MINUTES.
    • getSleepDelay

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

      public abstract AlertLevelAndMessage getAlertLevelAndMessage(AlertLevel curAlertLevel, TableResult result)
      Determines the alert level and message for the provided result. This result may also represent the error state. The error state will always have columns=1, rows=1, and tableData.size() == 1
    • getColumns

      protected abstract int getColumns()
      Gets the number of columns in the table data.
    • getColumnHeaders

      protected abstract SerializableFunction<Locale,? extends List<String>> getColumnHeaders()
      Gets the column headers.
    • getQueryResult

      protected abstract R getQueryResult() throws InterruptedException, Exception
      Gets the current table data for this worker.
    • getTableData

      protected abstract SerializableFunction<Locale,? extends List<? extends D>> getTableData(R queryResult) throws Exception
      Gets the table data for the query result. This must be processed quickly.
    • cancel

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

      protected abstract List<AlertLevel> getAlertLevels(R queryResult)
      Gets the alert levels for the provided data.