Class MXAggrDispatcher

java.lang.Object
com.metasolv.nm.processor.MXAggregator.MXAggrDispatcher

public class MXAggrDispatcher extends Object
This is a combination of FlexibleAggregatorFieldProcessor and FlexibleAggregatorHandler. Plus other stuff.
  • Field Details

  • Constructor Details

  • Method Details

    • getConfigValue

      public String getConfigValue(String key)
    • getIntConfigValue

      public int getIntConfigValue(String key)
    • neoInit

      protected void neoInit(int numThreads)
      New initialization to handle numThreads changes between startup.
      Parameters:
      numThreads -
    • readHashMapFromFile

      public LinkedHashMap readHashMapFromFile(File file)
      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

      public long getVolumeLimit(String volume)
      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

      protected String generateTableFilename(int th, int tb)
    • init

      @Deprecated protected void init(int numThreads)
      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

      public void createKey(int index, NAR nar, int fpID)
      This will generate and return a key based on the record.
    • storeNAR

      public void storeNAR(NAR nar, int index, boolean setTimer, int fpID)
      This will generate a key and store the NAR in the table.
    • storeNAR

      public void storeNAR(NAR nar, int index, boolean setTimer, int fpID, long absoluteTime)
    • storeNAR

      public void storeNAR(NAR nar, int index, boolean setTimer, int fpID, long currentTime, boolean inactiveCheck)
    • flushImmediate

      public void flushImmediate(NAR nar, int index, boolean setTimer, int fpID)
    • printTimer

      public void printTimer(NAR nar, int index, int fpID)
      To be used in debugging only. Print the time that a NAR will be flushed from the aggregator
    • storeNARReusingTimer

      public void storeNARReusingTimer(NAR nar, int index, int fpID)
      This will generate a key and store the NAR in the table with an old timer.
    • getNARKeepTimer

      public boolean getNARKeepTimer(NAR nar, int index, int fpID)
      This will remove a NAR but leave its timer.
    • removeNARTimer

      public boolean removeNARTimer(NAR nar, int index, int fpID)
      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

      public void removeTimer(NAR nar, int index, int fpID)
    • getAndRemoveNAR

      public boolean getAndRemoveNAR(NAR nar, int index, int fpID)
      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

      public byte[] generateOpeningTimeFromTrafficVolume(List trafficVolumes)
      Will return the integer day of year corresponding to the first traffic volume.
    • compareBytes

      public boolean compareBytes(DCFieldContainer narA, DCFieldContainer narB, FieldKey attrId)
      Performs a simple byte comparison on the attribute in the two NARs.
    • isAllKeyAttributesExists

      public void isAllKeyAttributesExists(NAR nar, int tableNumber)
    • getKeys

      public ArrayList<FlexibleNARKey> getKeys(NAR nar)
    • resetNarKeys

      public void resetNarKeys(int fpID)