org.apache.qpid.server.queue
Class ConcurrentDeliveryManager

java.lang.Object
  extended by org.apache.qpid.server.queue.ConcurrentDeliveryManager

public class ConcurrentDeliveryManager
extends java.lang.Object

Manages delivery of messages on behalf of a queue


Field Summary
 boolean compressBufferOnQueue
           
 
Method Summary
 void clearAllMessages()
           
 void deliver(java.lang.String name, AMQMessage msg)
          Handles message delivery.
 java.util.List<AMQMessage> getMessages()
           
 int getQueueMessageCount()
          This method should not be used to determin if there are messages in the queue.
 boolean hasQueuedMessages()
          Determines whether there are queued messages.
 void processAsync(java.util.concurrent.Executor executor)
          Requests that the delivery manager start processing the queue asynchronously if there is work that can be done (i.e.
 void removeAMessageFromTop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

compressBufferOnQueue

public boolean compressBufferOnQueue
Method Detail

hasQueuedMessages

public boolean hasQueuedMessages()
Determines whether there are queued messages. Sets _queueing to false if there are no queued messages. This needs to be atomic.

Returns:
true if there are queued messages

getQueueMessageCount

public int getQueueMessageCount()
This method should not be used to determin if there are messages in the queue.

Returns:
int The number of messages in the queue

getMessages

public java.util.List<AMQMessage> getMessages()

removeAMessageFromTop

public void removeAMessageFromTop()
                           throws org.apache.qpid.AMQException
Throws:
org.apache.qpid.AMQException

clearAllMessages

public void clearAllMessages()
                      throws org.apache.qpid.AMQException
Throws:
org.apache.qpid.AMQException

processAsync

public void processAsync(java.util.concurrent.Executor executor)
Requests that the delivery manager start processing the queue asynchronously if there is work that can be done (i.e. there are messages queued up and subscribers that can receive them.

This should be called when subscribers are added, but only after the consume-ok message has been returned as message delivery may start immediately. It should also be called after unsuspending a client.

Parameters:
executor - the executor on which the delivery should take place

deliver

public void deliver(java.lang.String name,
                    AMQMessage msg)
             throws FailedDequeueException
Handles message delivery. The delivery manager is always in one of two modes; it is either queueing messages for asynchronous delivery or delivering directly.

Parameters:
name - the name of the entity on whose behalf we are delivering the message
msg - the message to deliver
Throws:
FailedDequeueException - if the message could not be dequeued