Class TimerFlush

java.lang.Object
com.nt.udc.aggregator.AggregatorModule
com.nt.udc.aggregator.table.TimerFlush
All Implemented Interfaces:
ActionListener, EventListener

public class TimerFlush extends AggregatorModule implements ActionListener
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 Details

    • flushTimerQueue

      public Vector flushTimerQueue
  • Constructor Details

  • 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 class AggregatorModule
      Returns:
      Array of integers, representing the fields to initialize.
    • startFlushTimer

      public void startFlushTimer()
      Starts the flush timer thread.
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      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 interface ActionListener
    • shutdown

      public void shutdown()
      Shuts down the flushing capabilities, including the flush timer.
      Specified by:
      shutdown in class AggregatorModule
    • 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

      public void resetFlushTimer(Object key)
      Reset the flush timer for a given entry in the table, as determined by the "FlushTimerSet" configuration setting.
    • addRecord

      public void addRecord(Object key)
      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 class AggregatorModule