Package com.aoindustries.noc.monitor
Class TableResultWorker<R,D>
java.lang.Object
com.aoindustries.noc.monitor.TableResultWorker<R,D>
- All Implemented Interfaces:
Runnable
The workers for table results node.
TODO: Add persistence of the last report
- Author:
- AO Industries, Inc.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Cancels the current getTableData call on a best-effort basis.final AlertLevel
abstract AlertLevelAndMessage
getAlertLevelAndMessage
(AlertLevel curAlertLevel, TableResult result) Determines the alert level and message for the provided result.protected abstract List<AlertLevel>
getAlertLevels
(R queryResult) Gets the alert levels for the provided data.protected abstract SerializableFunction<Locale,
? extends List<String>> Gets the column headers.protected abstract int
Gets the number of columns in the table data.protected int
The default startup delay is within five minutes.protected abstract R
Gets the current table data for this worker.protected long
getSleepDelay
(boolean lastSuccessful, AlertLevel alertLevel) The default sleep delay is five minutes when successful or one minute when unsuccessful.protected abstract SerializableFunction<Locale,
? extends List<? extends D>> getTableData
(R queryResult) Gets the table data for the query result.protected long
Gets the timeout value.protected TimeUnit
Gets the timeout time unit.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.final void
run()
-
Field Details
-
persistenceFile
-
-
Constructor Details
-
TableResultWorker
-
-
Method Details
-
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() -
getTimeout
protected long getTimeout()Gets the timeout value. Defaults to5
. -
getTimeoutUnit
Gets the timeout time unit. Defaults toTimeUnit.MINUTES
. -
getSleepDelay
The default sleep delay is five minutes when successful or one minute when unsuccessful.- Parameters:
alertLevel
- Whennull
, treated asAlertLevel.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
Gets the column headers. -
getQueryResult
Gets the current table data for this worker.- Throws:
InterruptedException
Exception
-
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.- Throws:
Exception
-
cancel
Cancels the current getTableData call on a best-effort basis. Implementations of this method must not block. This default implementation callsfuture.cancel(true)
. -
getAlertLevels
Gets the alert levels for the provided data.
-