Package com.nt.udc.aggregator.table
Class TableFlush
java.lang.Object
com.nt.udc.aggregator.AggregatorModule
com.nt.udc.aggregator.table.TableFlush
This class handles basic flushing-related functionality.
Complicated flushing procedures should go in separate classes that
are specifically written for their needs. All and any flushing-related
capabilities do not necessarily belong in here.
-
Field Summary
Fields inherited from class com.nt.udc.aggregator.AggregatorModule
config, logger -
Constructor Summary
ConstructorsConstructorDescriptionTableFlush(ConfigIfc config, LoggerIfc logger, AggrTable table, DCStreamHandler streamHandler, String nodeID, int nodeType) -
Method Summary
Modifier and TypeMethodDescriptionvoidFlushes the complete table.voidflushRecord(NAR nar) Flushes the given record to the next node.voidflushRecordAndRemove(NAR nar, NARKey key) Flushes the given record to the next node, and removes all traces of it from the table.voidflushRecords(NAR[] nars) Flushes the given set of records to the next node.voidflushTableRecord(NARKey key) Flushes the given record to the next node, after removing it from the table.voidflushTableRecords(NARKey[] keys) Flushes the set of records to the next node, after removing it from the table.protected voidThis method should obtain the necessary information from the config class, in order to configure the module.voidFlushes the table based on whether the "FlushOnStartup" configuration setting is set to true.int[]Returns the fields that should be stored in a newly created record entry.voidshutdown()This method should handle shutting down the routines that have been started by this class.
-
Constructor Details
-
TableFlush
public TableFlush(ConfigIfc config, LoggerIfc logger, AggrTable table, DCStreamHandler streamHandler, String nodeID, int nodeType)
-
-
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:
recordInitFieldsin classAggregatorModule- Returns:
- Array of integers, representing the fields to initialize.
-
shutdown
public void shutdown()Description copied from class:AggregatorModuleThis method should handle shutting down the routines that have been started by this class.- Specified by:
shutdownin classAggregatorModule
-
flushRecord
Flushes the given record to the next node.- Parameters:
nar- NAR to flush to the next node
-
flushRecordAndRemove
Flushes the given record to the next node, and removes all traces of it from the table. Note that this method exists because of the side effect of using a disk-based table. It is possible to have a different record in memory than on disk, even if the records have the same key. Therefore, if you have a record in memory that you want flushed, but also want it removed from the table (and NOT have that version flushed), use this method. This method is equivalent to: - table.remove(key); - flushRecord(nar);- Parameters:
nar- Record to flush to next nodekey- Key of element to remove from table (but NOT flush to next node)
-
flushRecords
Flushes the given set of records to the next node.- Parameters:
nars- NARs to flush to the next node
-
flushTableRecord
Flushes the given record to the next node, after removing it from the table. If the record doesn't exist in the table, nothing happens.- Parameters:
key- key of the NAR in the table
-
flushTableRecords
Flushes the set of records to the next node, after removing it from the table. If the record doesn't exist in the table, nothing happens.- Parameters:
keys- keys of the NARs in the table
-
initialFlush
public void initialFlush()Flushes the table based on whether the "FlushOnStartup" configuration setting is set to true. -
completeFlush
public void completeFlush()Flushes the complete table. -
getConfigData
protected void getConfigData()Description copied from class:AggregatorModuleThis method should obtain the necessary information from the config class, in order to configure the module.- Specified by:
getConfigDatain classAggregatorModule
-