Class TNCEventSender

java.lang.Object
com.nt.udc.testnodechain.callbacks.TNCEventSender
All Implemented Interfaces:
TNCEventSenderIfc, Serializable
Direct Known Subclasses:
TNCCallbackHandler

public class TNCEventSender extends Object implements TNCEventSenderIfc
See Also:
  • Field Details

  • Constructor Details

    • TNCEventSender

      public TNCEventSender(Logger l)
  • Method Details

    • addReceiver

      public void addReceiver(String receiverID, TNCEventReceiverIfc receiver)
      Adds a receiver without subscribing to any tests This method adds a receiver to the sender. The receiver is not subscribed to any test
      Specified by:
      addReceiver in interface TNCEventSenderIfc
      Parameters:
      receiverID - The unique identifier for the receiver to be added.
      receiver - An object implementing the TNCEventReceiverIfc interface to be added as a receiver.
    • addReceiver

      public void addReceiver(String receiverID, TNCEventReceiverIfc receiver, boolean subForAllTests)
      Adds a receiver with optional subscription to events. This method adds a receiver to the sender, associating it with the provided receiver ID. Optionally, the receiver can be subscribed to events for all tests if the 'subForAllTests' parameter is set to true.
      Specified by:
      addReceiver in interface TNCEventSenderIfc
      Parameters:
      receiverID - The unique identifier for the receiver to be added.
      receiver - An object implementing the TNCEventReceiverIfc interface to be added as a receiver.
      subForAllTests - A boolean flag indicating whether the receiver should be subscribed to events for all tests.
    • isReceiverValid

      public boolean isReceiverValid(String receiverId)
      This method checks if the receiver still exists with Admin Server
      Parameters:
      receiverId - Unique identifier for connection between RSM and AdminServer
      Returns:
    • newTestSubscriberAdded

      protected void newTestSubscriberAdded(String receiverID, String testID)
      This method is called when a new test subscriber is added, providing information about the receiver ID and the associated test ID.
      Parameters:
      receiverID - The identifier of the new test subscriber.
      testID - The unique identifier of the test associated with the new subscriber.
    • subscribeForTest

      public void subscribeForTest(String receiverID, String testID)
      Subscribes a receiver to receive events for a specific test. This method is responsible for subscribing a receiver identified by the provided receiver ID to receive events associated with the specified test identified by the given test ID.
      Specified by:
      subscribeForTest in interface TNCEventSenderIfc
      Parameters:
      receiverID - The unique identifier of the receiver to be subscribed.
      testID - The unique identifier of the test for which the receiver is subscribing.
    • nodeStatisticsChange

      public void nodeStatisticsChange(List<NodeUpdateEvent> nodeData)
      Notifies the receivers about changes in node statistics based on the given list of NodeUpdateEvent instances. This method broadcasts the node statistics changes to registered receivers associated with specific tests and broadcast receivers.
      Specified by:
      nodeStatisticsChange in interface TNCEventSenderIfc
      Parameters:
      nodeData - A list of NodeUpdateEvent instances representing the updated node statistics.
    • nodeStatusChange

      public void nodeStatusChange(NodeStatusUpdateEventIfc nodeStatus)
      Description copied from interface: TNCEventSenderIfc
      Sends node status changes to the associated receivers.
      Specified by:
      nodeStatusChange in interface TNCEventSenderIfc
      Parameters:
      nodeStatus - The NodeStatusUpdateEventIfc object representing the updated node status.
    • testStatusChange

      public void testStatusChange(TestStatusChangeEventIfc testStatus)
      Description copied from interface: TNCEventSenderIfc
      Sends test status changes to the associated receivers.
      Specified by:
      testStatusChange in interface TNCEventSenderIfc
      Parameters:
      testStatus - The TestStatusChangeEventIfc object representing the updated test status.
    • nodeOutputFileAvailable

      public void nodeOutputFileAvailable(NodeOutputFileAvailableEvent nodeOutputFileAvailable)
      Description copied from interface: TNCEventSenderIfc
      Sends an event when there are output files available for a node to the associated receivers.
      Specified by:
      nodeOutputFileAvailable in interface TNCEventSenderIfc
      Parameters:
      nodeOutputFileAvailable - The NodeOutputFileAvailableEvent object representing the output file data
    • testAboutToTimeout

      public void testAboutToTimeout(TestTimeoutReminderEvent event)
      Description copied from interface: TNCEventSenderIfc
      Notifies that a test is about to timeout to the associated receivers.
      Specified by:
      testAboutToTimeout in interface TNCEventSenderIfc
      Parameters:
      event - The TestTimeoutReminderEvent containing information about the test about to timeout.
    • bulkEvents

      public void bulkEvents(String receiverID, List<BaseEventIfc> events)
      Description copied from interface: TNCEventSenderIfc
      Sends bulk events to the specified receiver identified by recieverID.
      Specified by:
      bulkEvents in interface TNCEventSenderIfc
      Parameters:
      receiverID - The unique identifier of the receiver for which the bulk events are sent.
      events - A List of BaseEventIfc objects representing the bulk events to be sent.
    • removeReceiver

      public boolean removeReceiver(String receiverID)
      Removes a receiver identified by the given receiver ID. This method is responsible for removing a receiver from the system based on the provided receiver ID.
      Parameters:
      receiverID - The unique identifier of the receiver to be removed.
    • removeTestListener

      protected void removeTestListener(String testId)
    • freeUpTestResources

      public void freeUpTestResources(String testId, boolean removeTestListeners)
      Description copied from interface: TNCEventSenderIfc
      Frees up resources associated with a test identified by the given test ID.
      Specified by:
      freeUpTestResources in interface TNCEventSenderIfc
      Parameters:
      testId - The unique identifier of the test whose resources should be freed up.
      removeTestListeners - A boolean flag indicating whether to remove test listeners associated with the test. If set to true, the test listeners will be removed; otherwise, they will be retained.
    • hasHistoricEvents

      public boolean hasHistoricEvents(String testId)
      Description copied from interface: TNCEventSenderIfc
      Checks whether there are historic events associated with the specified test ID.
      Specified by:
      hasHistoricEvents in interface TNCEventSenderIfc
      Parameters:
      testId - The unique identifier of the test to check for historic events.
      Returns:
      true if there are historic events for the given test ID; false otherwise.
    • clear

      public void clear()
    • logInfo

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

      public void logInfo(String x)
    • logDebug

      public void logDebug(Supplier<String> x)
    • logDebug

      public void logDebug(Supplier<String> x, Exception e)