Class TableResultNodeWorker<QR,​TD>

  • All Implemented Interfaces:

    public abstract class TableResultNodeWorker<QR,​TD>
    extends Object
    implements Runnable
    The workers for table results node. TODO: Add persistence of the last report
    AO Industries, Inc.
    • Field Detail

      • persistenceFile

        protected final File persistenceFile
    • Constructor Detail

      • TableResultNodeWorker

        protected TableResultNodeWorker​(File persistenceFile)
    • Method Detail

      • getAlertLevel

        public final AlertLevel getAlertLevel()
      • getNextStartupDelay

        protected int getNextStartupDelay()
        The default startup delay is within five minutes.
      • 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.
      • getQueryResult

        protected abstract QR getQueryResult()
                                      throws Exception
        Gets the current table data for this worker.
      • cancel

        protected void cancel​(Future<QR> 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​(QR queryResult)
        Gets the alert levels for the provided data.