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 TypeMethodDescriptionvoidThis method is called when the flush timer expires.voidAdds a record to the flush timer's list of records to flush.voidAdds a record to the flush timer's list of records to flush.voidaddRecordWithRetention(Object key, long currTime, boolean inactiveCheckflag) booleancontainsRecord(Object key) voiddeactivateTimer(FlexibleNARKey searchKey) This will mark a key as inactive so it cannot be flushed.voidbooleanAdded for Node Health support.voidprintTimerValue(FlexibleNARKey searchKey) Should only be used for debug purposes.voidreactivateTimer(FlexibleNARKey searchKey) This will re-activate a previously deactivated timer.voidThis 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.voidremoveRecord(Object key) voidresetFlushTimer(Object key) Reset the flush timer for a given entry in the table, as determined by the "FlushTimerSet" configuration setting.voidsetFlushTimerValue(int flushInterval) Sets the initialFlushTimerIntervalvoidsetFlushTimerValue(long flushInterval) voidsetInactiveKeyTimerInterval(String interval) voidsetKeyInactivePeriod(String inactivePeriod) voidshutdown()Shuts down the flushing capabilities, including the flush timer.voidStarts the flush timer thread.voidstartInactiveKeyFlushTimer(String nodeId) voidwriteHashMapToFile(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:
actionPerformedin 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.
-