Class UDPMulticast

java.lang.Object
com.bank.trading.data.UDPMulticast
All Implemented Interfaces:
Runnable

public class UDPMulticast extends Object implements Runnable
This class is responsible for the UDP multicast. The UDP multicast is used to stream data to all parts of the system. This is run as a thread on the Lamport service.
  • Constructor Details

    • UDPMulticast

      public UDPMulticast(List<InetSocketAddress> subscribers, LinkedBlockingQueue<Event> queue)
      Constructor to initialize the UDP multicast with a list of subscribers.
      Parameters:
      subscribers - The list of subscribers to send the data to.
      queue - The queue to get the data from the Lamport Clock.
  • Method Details

    • addSubscriber

      public void addSubscriber(InetSocketAddress subscriber)
      Add a new subscriber to the list of subscribers.
      Parameters:
      subscriber - The address of the new subscriber.
    • removeSubscriber

      public void removeSubscriber(InetSocketAddress subscriber)
      Remove a subscriber from the list of subscribers.
      Parameters:
      subscriber - The address of the subscriber to be removed.
    • run

      public void run()
      This method is responsible for running the UDP multicast service. It continuously polls the queue for new events and sends them to all subscribers.
      Specified by:
      run in interface Runnable
    • shutdown

      public void shutdown()