Class MessageQueue


  • public class MessageQueue
    extends Object
    This class holds the queued messages which are to be processed in the MessageRouter.
    • Method Detail

      • put

        public void put​(DelayableImmutableMessage delayableImmutableMessage)
        Add the passed in message to the queue of messages to be processed.
        Parameters:
        delayableImmutableMessage - the message to add.
      • poll

        public DelayableImmutableMessage poll​(long timeout,
                                              TimeUnit unit)
                                       throws InterruptedException
        Polls the message queue for a period no longer than the timeout specified for a new message.
        Parameters:
        timeout - the maximum time to wait for a message to become available.
        unit - the time unit of measurement for timeout
        Returns:
        a new message if one is available, or null if none became available within the specified time limit.
        Throws:
        InterruptedException - if the thread was interrupted while waiting for a message to become available.