org.mule.util.queue
Class DefaultQueueInfoDelegate

java.lang.Object
  extended by org.mule.util.queue.DefaultQueueInfoDelegate
All Implemented Interfaces:
QueueInfoDelegate, TransientQueueInfoDelegate

public class DefaultQueueInfoDelegate
extends Object
implements TransientQueueInfoDelegate

The default QueueInfoDelegate. This uses a LinkedList to store the members of the queue.


Field Summary
protected  int capacity
           
protected  LinkedList<Serializable> list
           
 
Constructor Summary
DefaultQueueInfoDelegate(int capacity)
           
 
Method Summary
 boolean addAll(Collection<? extends Serializable> items)
          Appends all of the elements in the specified collection to the queue (optional operation).
 int getSize()
          Return the size of the queue
 boolean offer(Serializable o, int room, long timeout)
          Offer to append a new member to the end of the queue
 Serializable peek()
          return, but do not remove, the first member of the queue
 Serializable poll(long timeout)
          Poll the queue for its first member, and, if there is one, remove and return it
 void putNow(Serializable o)
          append a new member to the end of the queue
 void untake(Serializable item)
          Restore a previously removed member to the front of the queue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

capacity

protected final int capacity

list

protected final LinkedList<Serializable> list
Constructor Detail

DefaultQueueInfoDelegate

public DefaultQueueInfoDelegate(int capacity)
Method Detail

putNow

public void putNow(Serializable o)
Description copied from interface: QueueInfoDelegate
append a new member to the end of the queue

Specified by:
putNow in interface QueueInfoDelegate

offer

public boolean offer(Serializable o,
                     int room,
                     long timeout)
              throws InterruptedException
Description copied from interface: QueueInfoDelegate
Offer to append a new member to the end of the queue

Specified by:
offer in interface QueueInfoDelegate
Throws:
InterruptedException

poll

public Serializable poll(long timeout)
                  throws InterruptedException
Description copied from interface: QueueInfoDelegate
Poll the queue for its first member, and, if there is one, remove and return it

Specified by:
poll in interface QueueInfoDelegate
Throws:
InterruptedException

peek

public Serializable peek()
                  throws InterruptedException
Description copied from interface: QueueInfoDelegate
return, but do not remove, the first member of the queue

Specified by:
peek in interface QueueInfoDelegate
Throws:
InterruptedException

untake

public void untake(Serializable item)
            throws InterruptedException
Description copied from interface: QueueInfoDelegate
Restore a previously removed member to the front of the queue

Specified by:
untake in interface QueueInfoDelegate
Throws:
InterruptedException

getSize

public int getSize()
Description copied from interface: QueueInfoDelegate
Return the size of the queue

Specified by:
getSize in interface QueueInfoDelegate

addAll

public boolean addAll(Collection<? extends Serializable> items)
Description copied from interface: QueueInfoDelegate
Appends all of the elements in the specified collection to the queue (optional operation).

Specified by:
addAll in interface QueueInfoDelegate
Parameters:
items - to be added to the queue
Returns:
true if this queue changed as a result of the call


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.