Class PriorityMessageQueue

    • Constructor Detail

      • PriorityMessageQueue

        public PriorityMessageQueue()
    • Method Detail

      • enqueue

        public void enqueue​(JmsInboundMessageDispatch envelope)
        Description copied from interface: MessageQueue
        Adds the given message envelope to the end of the Message queue.
        Specified by:
        enqueue in interface MessageQueue
        Parameters:
        envelope - The in-bound Message envelope to enqueue.
      • enqueueFirst

        public void enqueueFirst​(JmsInboundMessageDispatch envelope)
        Description copied from interface: MessageQueue
        Adds the given message envelope to the front of the Message queue.
        Specified by:
        enqueueFirst in interface MessageQueue
        Parameters:
        envelope - The in-bound Message envelope to enqueue.
      • dequeue

        public final JmsInboundMessageDispatch dequeue​(long timeout)
                                                throws java.lang.InterruptedException
        Description copied from interface: MessageQueue
        Used to get an enqueued message. The amount of time this method blocks is based on the timeout value. - if timeout==-1 then it blocks until a message is received. - if timeout==0 then it it tries to not block at all, it returns a message if it is available - if timeout > 0 then it blocks up to timeout amount of time. Expired messages will consumed by this method.
        Specified by:
        dequeue in interface MessageQueue
        Parameters:
        timeout - The amount of time to wait for an entry to be added before returning null.
        Returns:
        null if we timeout or if the consumer is closed.
        Throws:
        java.lang.InterruptedException - if the wait is interrupted.
      • dequeueNoWait

        public final JmsInboundMessageDispatch dequeueNoWait()
        Description copied from interface: MessageQueue
        Used to get an enqueued Message if on exists, otherwise returns null.
        Specified by:
        dequeueNoWait in interface MessageQueue
        Returns:
        the next Message in the Queue if one exists, otherwise null.
      • start

        public final void start()
        Description copied from interface: MessageQueue
        Starts the Message Queue. An non-started Queue will always return null for any of the Queue methods.
        Specified by:
        start in interface MessageQueue
      • stop

        public final void stop()
        Description copied from interface: MessageQueue
        Stops the Message Queue. Messages cannot be read from the Queue when it is in the stopped state and any waiters will be woken.
        Specified by:
        stop in interface MessageQueue
      • close

        public final void close()
        Description copied from interface: MessageQueue
        Closes the Message Queue. No messages can be added or removed from the Queue once it has entered the closed state.
        Specified by:
        close in interface MessageQueue
      • isRunning

        public final boolean isRunning()
        Specified by:
        isRunning in interface MessageQueue
        Returns:
        true if the Queue is not in the stopped or closed state.
      • isClosed

        public final boolean isClosed()
        Specified by:
        isClosed in interface MessageQueue
        Returns:
        true if the Queue has been closed.
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface MessageQueue
        Returns:
        true if there are no messages in the queue.
      • size

        public int size()
        Description copied from interface: MessageQueue
        Returns the number of Messages currently in the Queue. This value is only meaningful at the time of the call as the size of the Queue changes rapidly as Messages arrive and are consumed.
        Specified by:
        size in interface MessageQueue
        Returns:
        the current number of Messages in the Queue.
      • clear

        public void clear()
        Description copied from interface: MessageQueue
        Clears the Queue of any Messages.
        Specified by:
        clear in interface MessageQueue