Class FifoDeliveryQueue
java.lang.Object
org.apache.qpid.protonj2.client.util.FifoDeliveryQueue
- All Implemented Interfaces:
- DeliveryQueue
Simple first in / first out 
Delivery Queue.- 
Constructor SummaryConstructorsConstructorDescriptionFifoDeliveryQueue(int queueDepth) Creates a new first in / first out message queue with the given queue depth
- 
Method SummaryModifier and TypeMethodDescriptionvoidclear()Clears the Queue of any queuedDeliveryvalues.voidclose()Closes the Delivery Queue.dequeue(long timeout) Used to get anDelivery.Used to get an enqueuedDeliveryif on exists, otherwise returns null.voidenqueue(ClientDelivery envelope) Adds the givenDeliveryto the end of the Delivery queue.voidenqueueFirst(ClientDelivery envelope) Adds the givenDeliveryto the front of the queue.booleanisClosed()booleanisEmpty()booleanintsize()Returns the number of deliveries currently in the Queue.voidstart()Starts the Delivery Queue.voidstop()Stops the Delivery Queue.toString()
- 
Constructor Details- 
FifoDeliveryQueuepublic FifoDeliveryQueue(int queueDepth) Creates a new first in / first out message queue with the given queue depth- Parameters:
- queueDepth- The Queue depth to configure for this FIFO Message Queue.
 
 
- 
- 
Method Details- 
enqueueFirstDescription copied from interface:DeliveryQueueAdds the givenDeliveryto the front of the queue.- Specified by:
- enqueueFirstin interface- DeliveryQueue
- Parameters:
- envelope- The in-bound Delivery to enqueue.
 
- 
enqueueDescription copied from interface:DeliveryQueueAdds the givenDeliveryto the end of the Delivery queue.- Specified by:
- enqueuein interface- DeliveryQueue
- Parameters:
- envelope- The in-bound Delivery to enqueue.
 
- 
dequeueDescription copied from interface:DeliveryQueueUsed to get anDelivery. 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.
 - Specified by:
- dequeuein interface- DeliveryQueue
- 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 Receiveris closed.
- Throws:
- InterruptedException- if the wait is interrupted.
 
- 
dequeueNoWaitDescription copied from interface:DeliveryQueueUsed to get an enqueuedDeliveryif on exists, otherwise returns null.- Specified by:
- dequeueNoWaitin interface- DeliveryQueue
- Returns:
- the next Delivery in the Queue if one exists, otherwise null.
 
- 
startpublic void start()Description copied from interface:DeliveryQueueStarts the Delivery Queue. An non-started Queue will always return null for any of the Queue methods.- Specified by:
- startin interface- DeliveryQueue
 
- 
stoppublic void stop()Description copied from interface:DeliveryQueueStops the Delivery Queue. Deliveries cannot be read from the Queue when it is in the stopped state and any waiters will be woken.- Specified by:
- stopin interface- DeliveryQueue
 
- 
closepublic void close()Description copied from interface:DeliveryQueueCloses the Delivery Queue. No Delivery can be added or removed from the Queue once it has entered the closed state.- Specified by:
- closein interface- DeliveryQueue
 
- 
isRunningpublic boolean isRunning()- Specified by:
- isRunningin interface- DeliveryQueue
- Returns:
- true if the Queue is not in the stopped or closed state.
 
- 
isClosedpublic boolean isClosed()- Specified by:
- isClosedin interface- DeliveryQueue
- Returns:
- true if the Queue has been closed.
 
- 
isEmptypublic boolean isEmpty()- Specified by:
- isEmptyin interface- DeliveryQueue
- Returns:
- true if there are no deliveries in the queue.
 
- 
sizepublic int size()Description copied from interface:DeliveryQueueReturns 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.- Specified by:
- sizein interface- DeliveryQueue
- Returns:
- the current number of Deliveryobjects in the Queue.
 
- 
clearpublic void clear()Description copied from interface:DeliveryQueueClears the Queue of any queuedDeliveryvalues.- Specified by:
- clearin interface- DeliveryQueue
 
- 
toString
 
-