Package com.nt.udc.aggregator.table
Class TimerFlush
java.lang.Object
com.nt.udc.aggregator.AggregatorModule
com.nt.udc.aggregator.table.TimerFlush
- All Implemented Interfaces:
ActionListener
,EventListener
This class handles all timer related flushing functionality.
Currently, this timer flushing class supports the following:
- starting/stopping the timer
- adding new elements to be flushed by the timer
- updating elements' flush time
- removing elements that would be flushed by the timer
-
Field Summary
FieldsFields inherited from class com.nt.udc.aggregator.AggregatorModule
config, logger
-
Constructor Summary
ConstructorsConstructorDescriptionTimerFlush
(ConfigIfc config, LoggerIfc logger, AggrTable table, TableFlush flushHandler) -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method is called when the flush timer expires.void
Adds a record to the flush timer's list of records to flush.protected void
This method should obtain the necessary information from the config class, in order to configure the module.boolean
Added for Node Health support.void
Rebuilds the flush timer's list of records to flush from the existing table.int[]
Returns the fields that should be stored in a newly created record entry.void
resetFlushTimer
(Object key) Reset the flush timer for a given entry in the table, as determined by the "FlushTimerSet" configuration setting.void
shutdown()
Shuts down the flushing capabilities, including the flush timer.void
Starts the flush timer thread.
-
Field Details
-
flushTimerQueue
-
-
Constructor Details
-
TimerFlush
-
-
Method Details
-
recordInitFields
public int[] recordInitFields()Returns the fields that should be stored in a newly created record entry. The fields returned are those that this object uses/knows about.- Specified by:
recordInitFields
in classAggregatorModule
- Returns:
- Array of integers, representing the fields to initialize.
-
startFlushTimer
public void startFlushTimer()Starts the flush timer thread. -
actionPerformed
This method is called when the flush timer expires. This method will remove all of the expired records and write them out.- Specified by:
actionPerformed
in interfaceActionListener
-
shutdown
public void shutdown()Shuts down the flushing capabilities, including the flush timer.- Specified by:
shutdown
in classAggregatorModule
-
rebuildFlushTimerList
public void rebuildFlushTimerList()Rebuilds the flush timer's list of records to flush from the existing table. If the existing table is empty, then this method doesn't do anything. -
resetFlushTimer
Reset the flush timer for a given entry in the table, as determined by the "FlushTimerSet" configuration setting. -
addRecord
Adds a record to the flush timer's list of records to flush. The flush time of the given record is based off: flush time = current time + flush interval- Parameters:
key
- Key of the record to be flushed at a later time.
-
isHealthy
public boolean isHealthy()Added for Node Health support. Only checks the internal timer to see if it is healthy. -
getConfigData
protected void getConfigData()Description copied from class:AggregatorModule
This method should obtain the necessary information from the config class, in order to configure the module.- Specified by:
getConfigData
in classAggregatorModule
-