Class TNCUpdateEventProducer

java.lang.Object
com.nt.udc.testnodechain.nodemgr.TNCUpdateEventProducer

public class TNCUpdateEventProducer extends Object
This class maintains a record of the latest node updates and triggers the eventSender API in a scheduled manner. The purpose is to control the frequency of updates sent to the Admin Server, in a way throttling the updates and batching them. This class is responsible for updating StatistisUpdate for all the test under the NodeManager
  • Constructor Details

  • Method Details

    • subscribeForEvents

      public void subscribeForEvents(String testID, TNCProcessor processor)
      Subscribes to statistics update events produced by a TNCProcessor (consumer) for a specific test. This method initiates the subscription to events produced by the specified TNCProcessor associated with the given test ID.
      Parameters:
      testID - The unique identifier of the test for which event subscription is initiated.
      processor - The TNCProcessor instance producing events for the subscribed test.
    • unsubscribeFromEvents

      public void unsubscribeFromEvents(String testID)
      Unsubscribes from events for a specific test. This method terminates the subscription to events for the specified test identified by the given test ID.
      Parameters:
      testID - The unique identifier of the test for which event subscription is to be terminated.
    • eventConsumed

      public void eventConsumed(String testID, NodeStatisticsDataIfc nodeData) throws InterruptedException
      Notifies the system that an event has been consumed by a TNCProcessor (Consumer) for a specific test. This method is called by the TNCProcessor to inform the system that a new event has been consumed for the specified test, providing associated NodeStatisticsData. This method once invoked, would keep track of the latest nodeData in an internal map data structure. At any point, the map would contain only latest node updates.
      Parameters:
      testID - The unique identifier of the test for which the event has been consumed.
      nodeData - The NodeStatisticsData associated with the consumed event.
      Throws:
      InterruptedException - If the thread is interrupted while processing the consumed event.
    • shutdown

      public void shutdown()
    • stopWatchingTest

      public void stopWatchingTest(String testId)
    • logInfo

      public void logInfo(String x, Exception e)
    • logInfo

      public void logInfo(String x)
    • logDebug

      public void logDebug(Supplier<String> x)