Class MXAggrDispatcher
java.lang.Object
com.metasolv.nm.processor.MXAggregator.MXAggrDispatcher
This is a combination of FlexibleAggregatorFieldProcessor and
FlexibleAggregatorHandler. Plus other stuff.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected boolean[]
protected Timer
static final String
static final String
static final String
static final String
protected FlexibleAggrKeyFactory[]
static final String
protected FieldKey
protected FieldKey
protected FieldKey
protected FlexibleNARKey[][]
protected FlexibleAggrTable[][]
protected FlexibleTableFlush[][]
protected FlexibleTimerFlush[][]
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Indices into the TimeStamp byte[]. -
Constructor Summary
ConstructorsConstructorDescriptionMXAggrDispatcher
(DCNode parent, MXNarInputProcessor narInput, DataReceiverIfc narOutput, String nplFile, int numThreads) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkDailyFlush
(int fpID) Called by MXNarInputProcessor.isDataAvailable(), to do Daily Flush processing.boolean
compareBytes
(DCFieldContainer narA, DCFieldContainer narB, FieldKey attrId) Performs a simple byte comparison on the attribute in the two NARs.protected DCFieldProcessor
Sets up the general NPLFieldProcesser passing a NAR as the output class for the Field Processor, and passes the NPL file gained from the config for parsing instructions for the NPL.void
This will generate and return a key based on the record.boolean
distributeTrafficVolumesPerDay
(ListField trafficVolumes, NAR destContainer, List uplinkVolumeAttrs, List downlinkVolumeAttrs, ListField unprocessedVolumes, BytesField openingTime) This will distribute the traffic volume uplink and downlink volumes into appropriate daily bins according to the individual times.void
flushImmediate
(NAR nar, int index, boolean setTimer, int fpID) byte[]
generateOpeningTimeFromTrafficVolume
(List trafficVolumes) Will return the integer day of year corresponding to the first traffic volume.protected String
generateTableFilename
(int th, int tb) boolean
getAndRemoveNAR
(NAR nar, int index, int fpID) This will remove the NAR entry from the table.getConfigValue
(String key) int
getCount
(long tempKey, long tempKey1, long tempKey2, int index) Gets the Countint
getIntConfigValue
(String key) boolean
getNARKeepTimer
(NAR nar, int index, int fpID) This will remove a NAR but leave its timer.long
getVolumeLimit
(String volume) Converts the string representation of value into long Example: volume is 10KB then returns 10240protected void
init
(int numThreads) Deprecated.Use neoInit().void
isAllKeyAttributesExists
(NAR nar, int tableNumber) protected void
neoInit
(int numThreads) New initialization to handle numThreads changes between startup.protected FlexibleAggrTable[][]
openAndReassignAggrTable
(int numThreads, int numTables, int compressThreshold) This method will examine the scratch directory for existing aggrtable files.int
populateIndividualTrafficVolume
(Map trafficVolumeMap, DCFieldContainer destContainer, List uplinkVolumeIDs, List downlinkVolumeIDs, BytesField nextOpeningTime, int dayOfYearCheck) Will only populate the traffic volumes if they are for the same day as dayOfYearCheck, unless dayOfYearCheck invalid input: '<' 1.void
printTimer
(NAR nar, int index, int fpID) To be used in debugging only.readHashMapFromFile
(File file) Reads FlexibleNARTimer objects from the filevoid
removeDeactivatedTimer
(int index, int fpID) This will remove a deactivated timer.boolean
removeNAR
(int index, int fpID) This will remove a NAR entry from the table without returning the removed entry.boolean
removeNARTimer
(NAR nar, int index, int fpID) This will remove the timer for a NAR from the timer table.void
removeTimer
(NAR nar, int index, int fpID) void
reset
(long cleanup) Reset the Countvoid
resetCount
(long tempKey, long tempKey1, long tempKey2, int index) void
resetNarKeys
(int fpID) void
setCount
(long tempKey, long tempKey1, long tempKey2, int index) Sets the Countboolean
void
shutdown()
protected void
protected void
void
This will generate a key and store the NAR in the table.void
void
void
storeNARReusingTimer
(NAR nar, int index, int fpID) This will generate a key and store the NAR in the table with an old timer.
-
Field Details
-
tableArray
-
keyFactoryArray
-
timerFlushArray
-
tableFlushArray
-
narKeyArray
-
dailyFlushFlagArray
protected boolean[] dailyFlushFlagArray -
mapChangeTime
-
mapUplinkVolume
-
mapDownlinkVolume
-
dailyFlushFeatureEnabled
protected boolean dailyFlushFeatureEnabled -
dailyFlushTimer
-
TS_YEAR
public static final int TS_YEARIndices into the TimeStamp byte[].- See Also:
-
TS_MONTH
public static final int TS_MONTH- See Also:
-
TS_DAY
public static final int TS_DAY- See Also:
-
TS_HOUR
public static final int TS_HOUR- See Also:
-
TS_MINUTE
public static final int TS_MINUTE- See Also:
-
TS_SECOND
public static final int TS_SECOND- See Also:
-
TS_SIGN
public static final int TS_SIGN- See Also:
-
TS_OFFSET_HOUR
public static final int TS_OFFSET_HOUR- See Also:
-
TS_OFFSET_MINUTE
public static final int TS_OFFSET_MINUTE- See Also:
-
INACTIVE_PERIOD
- See Also:
-
INACTIVE_TIMER_INTERVAL
- See Also:
-
FLUSH_INACTIVE_KEY
- See Also:
-
LOG_LATEST_FLUSH_TIME
- See Also:
-
FLUSH_INDICATOR_DIRECTORY
- See Also:
-
-
Constructor Details
-
MXAggrDispatcher
public MXAggrDispatcher(DCNode parent, MXNarInputProcessor narInput, DataReceiverIfc narOutput, String nplFile, int numThreads)
-
-
Method Details
-
getConfigValue
-
getIntConfigValue
-
neoInit
protected void neoInit(int numThreads) New initialization to handle numThreads changes between startup.- Parameters:
numThreads
-
-
readHashMapFromFile
Reads FlexibleNARTimer objects from the file- Parameters:
file
- to read objects from- Returns:
- HashMap constructs HashMap with FlexibleNARKey and expiryTime from FlexibleNARTimer objects
-
setflushTimerActive
public boolean setflushTimerActive() -
getVolumeLimit
Converts the string representation of value into long Example: volume is 10KB then returns 10240- Parameters:
volume
-- Returns:
- long value
-
openAndReassignAggrTable
protected FlexibleAggrTable[][] openAndReassignAggrTable(int numThreads, int numTables, int compressThreshold) This method will examine the scratch directory for existing aggrtable files. If they exists, and their numbers do not match up with current configured number of threads, then a massive reassignment occurs to put filed records into the new properly-assigned aggrtable, based on the new modulus routing number.- Parameters:
numThreads
-numTables
-- Returns:
-
generateTableFilename
-
init
Deprecated.Use neoInit(). This method has a bug where records may get trapped in old databases if the number of threads is changed.- Parameters:
numThreads
-
-
shutdown
public void shutdown() -
startFieldProcessorThreads
protected void startFieldProcessorThreads() -
shutdownFieldProcessorThreads
protected void shutdownFieldProcessorThreads() -
createFieldProcessor
protected DCFieldProcessor createFieldProcessor(MXJavahookHandler hook) throws NodeProcessingException Sets up the general NPLFieldProcesser passing a NAR as the output class for the Field Processor, and passes the NPL file gained from the config for parsing instructions for the NPL. This method can be over-ridden by derived classes, if the derived class needs to construct its own field processor with additional information (for example, constructing the FieldProcessor with a IDCMethodHandler object).- Returns:
- The DCFieldProcessor that has been configured.
- Throws:
NodeProcessingException
-
checkDailyFlush
protected void checkDailyFlush(int fpID) Called by MXNarInputProcessor.isDataAvailable(), to do Daily Flush processing.- Parameters:
fpID
-
-
createKey
This will generate and return a key based on the record. -
storeNAR
This will generate a key and store the NAR in the table. -
storeNAR
-
storeNAR
public void storeNAR(NAR nar, int index, boolean setTimer, int fpID, long currentTime, boolean inactiveCheck) -
flushImmediate
-
printTimer
To be used in debugging only. Print the time that a NAR will be flushed from the aggregator -
storeNARReusingTimer
This will generate a key and store the NAR in the table with an old timer. -
getNARKeepTimer
This will remove a NAR but leave its timer. -
removeNARTimer
This will remove the timer for a NAR from the timer table. This should be used if the record was removed from the key table, but the timer value was left in the timer table, for example, if getNarSaveTimer was used. -
removeTimer
-
getAndRemoveNAR
This will remove the NAR entry from the table. KY: removed "performance enhancement" by putting synch lock back in. -
removeNAR
public boolean removeNAR(int index, int fpID) This will remove a NAR entry from the table without returning the removed entry. -
setCount
public void setCount(long tempKey, long tempKey1, long tempKey2, int index) Sets the Count -
getCount
public int getCount(long tempKey, long tempKey1, long tempKey2, int index) Gets the Count -
reset
public void reset(long cleanup) Reset the Count -
resetCount
public void resetCount(long tempKey, long tempKey1, long tempKey2, int index) -
removeDeactivatedTimer
public void removeDeactivatedTimer(int index, int fpID) This will remove a deactivated timer. -
distributeTrafficVolumesPerDay
public boolean distributeTrafficVolumesPerDay(ListField trafficVolumes, NAR destContainer, List uplinkVolumeAttrs, List downlinkVolumeAttrs, ListField unprocessedVolumes, BytesField openingTime) This will distribute the traffic volume uplink and downlink volumes into appropriate daily bins according to the individual times. If the traffic volumes goes past midnight, it will stop and return false. In this case, the volumes already processed for the previous day will be left processed. The list of traffic volumes will also have the processed volumes removed from the list. Only the unprocessed entries will remain. If no day change is detected, true is returned to indicate all traffic volumes have been processed. -
populateIndividualTrafficVolume
public int populateIndividualTrafficVolume(Map trafficVolumeMap, DCFieldContainer destContainer, List uplinkVolumeIDs, List downlinkVolumeIDs, BytesField nextOpeningTime, int dayOfYearCheck) Will only populate the traffic volumes if they are for the same day as dayOfYearCheck, unless dayOfYearCheck invalid input: '<' 1. If the same day, that day of the year will be returned. If a different day, 0 will be returned. If no time is provided in the traffic volume map, -1 is returned. -
generateOpeningTimeFromTrafficVolume
Will return the integer day of year corresponding to the first traffic volume. -
compareBytes
Performs a simple byte comparison on the attribute in the two NARs. -
isAllKeyAttributesExists
-
getKeys
-
resetNarKeys
public void resetNarKeys(int fpID)
-