Interface DeliveryQueue

  • All Known Implementing Classes:
    FifoDeliveryQueue

    public interface DeliveryQueue
    Queue based storage interface for inbound AMQP Delivery objects.
    • Method Detail

      • enqueue

        void enqueue​(ClientDelivery delivery)
        Adds the given Delivery to the end of the Delivery queue.
        Parameters:
        delivery - The in-bound Delivery to enqueue.
      • enqueueFirst

        void enqueueFirst​(ClientDelivery delivery)
        Adds the given Delivery to the front of the queue.
        Parameters:
        delivery - The in-bound Delivery to enqueue.
      • dequeue

        ClientDelivery dequeue​(long timeout)
                        throws java.lang.InterruptedException
        Used to get an Delivery. The amount of time this method blocks is based on the timeout value that is supplied to it.
        • If the timeout value is less than zero the dequeue operation blocks until a Delivery is enqueued or the queue is stopped.
        • If the timeout value is zero the dequeue operation will not block and will either return the next Delivery on the Queue or null to indicate the queue is empty.
        • If the timeout value is greater than zero then the method will either return the next Delivery in the queue or block until the timeout (in milliseconds) has expired or until a new Delivery is placed onto the queue.
        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 Receiver is closed.
        Throws:
        java.lang.InterruptedException - if the wait is interrupted.
      • dequeueNoWait

        ClientDelivery dequeueNoWait()
        Used to get an enqueued Delivery if on exists, otherwise returns null.
        Returns:
        the next Delivery in the Queue if one exists, otherwise null.
      • start

        void start()
        Starts the Delivery Queue. An non-started Queue will always return null for any of the Queue methods.
      • stop

        void stop()
        Stops the Delivery Queue. Deliveries cannot be read from the Queue when it is in the stopped state and any waiters will be woken.
      • close

        void close()
        Closes the Delivery Queue. No Delivery can be added or removed from the Queue once it has entered the closed state.
      • isRunning

        boolean isRunning()
        Returns:
        true if the Queue is not in the stopped or closed state.
      • isClosed

        boolean isClosed()
        Returns:
        true if the Queue has been closed.
      • isEmpty

        boolean isEmpty()
        Returns:
        true if there are no deliveries in the queue.
      • size

        int size()
        Returns the number of deliveries currently in the Queue. This value is only meaningful at the time of the call as the size of the Queue changes rapidly as deliveries arrive and are consumed.
        Returns:
        the current number of Delivery objects in the Queue.
      • clear

        void clear()
        Clears the Queue of any queued Delivery values.