Class FlexibleTimerFlush
java.lang.Object
com.nt.udc.flexibleAggregator.table.FlexibleTimerFlush
- 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
-
Constructor Summary
ConstructorsConstructorDescriptionFlexibleTimerFlush
(LoggerIfc theLogger, FlexibleAggrTable table, FlexibleTableFlush flushHandler, long flushIntervalMillis, boolean writeOutFlushedRecords, boolean longDurationCheck) -
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.void
Adds a record to the flush timer's list of records to flush.void
addRecordWithRetention
(Object key, long currTime, boolean inactiveCheckflag) boolean
containsRecord
(Object key) void
deactivateTimer
(FlexibleNARKey searchKey) This will mark a key as inactive so it cannot be flushed.void
boolean
Added for Node Health support.void
printTimerValue
(FlexibleNARKey searchKey) Should only be used for debug purposes.void
reactivateTimer
(FlexibleNARKey searchKey) This will re-activate a previously deactivated timer.void
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.void
removeRecord
(Object key) void
resetFlushTimer
(Object key) Reset the flush timer for a given entry in the table, as determined by the "FlushTimerSet" configuration setting.void
setFlushTimerValue
(int flushInterval) Sets the initialFlushTimerIntervalvoid
setFlushTimerValue
(long flushInterval) void
setInactiveKeyTimerInterval
(String interval) void
setKeyInactivePeriod
(String inactivePeriod) void
shutdown()
Shuts down the flushing capabilities, including the flush timer.void
Starts the flush timer thread.void
startInactiveKeyFlushTimer
(String nodeId) void
writeHashMapToFile
(File dir, String fName) Writes flushTimerMap data into a file
-
Constructor Details
-
FlexibleTimerFlush
public FlexibleTimerFlush(LoggerIfc theLogger, FlexibleAggrTable table, FlexibleTableFlush flushHandler, long flushIntervalMillis, boolean writeOutFlushedRecords, boolean longDurationCheck)
-
-
Method Details
-
startFlushTimer
public void startFlushTimer()Starts the flush timer thread. -
startInactiveKeyFlushTimer
-
setFlushTimerValue
public void setFlushTimerValue(int flushInterval) Sets the initialFlushTimerInterval- Parameters:
flushInterval
-
-
setFlushTimerValue
public void setFlushTimerValue(long flushInterval) -
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. -
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.
-
addRecord
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
-
containsRecord
-
addRecordWithRetention
-
setKeyInactivePeriod
-
setInactiveKeyTimerInterval
-
flushInactiveRecords
public void flushInactiveRecords() -
writeHashMapToFile
Writes flushTimerMap data into a file- Parameters:
dir
- Name of directoryfName
- Name of file
-
printTimerValue
Should only be used for debug purposes. Inform the time in milliseconds that a NAR will be flushed from the table -
deactivateTimer
This will mark a key as inactive so it cannot be flushed. -
reactivateTimer
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.
-