Class FlexibleTimerFlush

java.lang.Object
com.nt.udc.flexibleAggregator.table.FlexibleTimerFlush
All Implemented Interfaces:
ActionListener, EventListener

public class FlexibleTimerFlush extends Object 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
  • Constructor Details

  • Method Details

    • startFlushTimer

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

      public void startInactiveKeyFlushTimer(String nodeId)
    • setFlushTimerValue

      public void setFlushTimerValue(int flushInterval)
      Sets the initialFlushTimerInterval
      Parameters:
      flushInterval -
    • setFlushTimerValue

      public void setFlushTimerValue(long flushInterval)
    • 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.
    • 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.
    • addRecord

      public void addRecord(Object key, Long oldTime)
      Adds a record to the flush timer's list of records to flush.
      Parameters:
      key - Key of the record to be flushed at a later time.
      oldTime - expiry time of key
    • isHealthy

      public boolean isHealthy()
      Added for Node Health support. Only checks the internal timer to see if it is healthy.
    • removeRecord

      public void removeRecord(Object key)
    • containsRecord

      public boolean containsRecord(Object key)
    • addRecordWithRetention

      public void addRecordWithRetention(Object key, long currTime, boolean inactiveCheckflag)
    • setKeyInactivePeriod

      public void setKeyInactivePeriod(String inactivePeriod)
    • setInactiveKeyTimerInterval

      public void setInactiveKeyTimerInterval(String interval)
    • flushInactiveRecords

      public void flushInactiveRecords()
    • writeHashMapToFile

      public void writeHashMapToFile(File dir, String fName)
      Writes flushTimerMap data into a file
      Parameters:
      dir - Name of directory
      fName - Name of file
    • printTimerValue

      public void printTimerValue(FlexibleNARKey searchKey)
      Should only be used for debug purposes. Inform the time in milliseconds that a NAR will be flushed from the table
    • deactivateTimer

      public void deactivateTimer(FlexibleNARKey searchKey)
      This will mark a key as inactive so it cannot be flushed.
    • reactivateTimer

      public void reactivateTimer(FlexibleNARKey searchKey)
      This will re-activate a previously deactivated timer.
    • removeAllEntries

      public void removeAllEntries()
      This is used by the Daily Flush feature to remove all record entries from the timer tables, since all the records are about to be removed.