Class LinkedListMessageQueue<T>

java.lang.Object
com.example.server.handler.LinkedListMessageQueue<T>
All Implemented Interfaces:
MessageQueue<T>

public class LinkedListMessageQueue<T> extends Object implements MessageQueue<T>
Queue for message processing
  • Constructor Details

    • LinkedListMessageQueue

      public LinkedListMessageQueue(int minThreads, int maxThreads, MessageHandler<T> messageHandler)
  • Method Details

    • add

      public void add(T message)
      Add new message - request in processing
      Specified by:
      add in interface MessageQueue<T>
      Parameters:
      message - the message to be added
    • getNextMessage

      public T getNextMessage()
      Get the request from queue
      Specified by:
      getNextMessage in interface MessageQueue<T>
      Returns:
      the next message in the queue
    • shutdown

      public void shutdown()
      Stop the queue processing
      Specified by:
      shutdown in interface MessageQueue<T>
    • getCountThreads

      public int getCountThreads()
      Get number of threads in pool
      Specified by:
      getCountThreads in interface MessageQueue<T>
      Returns:
      the number of threads accessing the message queue