org.mule.util.queue
Class AbstractQueueStoreDelegate

java.lang.Object
  extended by org.mule.util.queue.AbstractQueueStoreDelegate
All Implemented Interfaces:
QueueStoreDelegate
Direct Known Subclasses:
DefaultQueueStoreDelegate, DualRandomAccessFileQueueStoreDelegate

public abstract class AbstractQueueStoreDelegate
extends Object
implements QueueStoreDelegate

Abstract queue delegate implementation that forces common queue behaviour


Constructor Summary
AbstractQueueStoreDelegate(int capacity)
           
 
Method Summary
protected abstract  void add(Serializable item)
          Adds an item at the end of the queue
 boolean addAll(Collection<? extends Serializable> items)
          Appends all of the elements in the specified collection to the queue (optional operation).
protected abstract  void addFirst(Serializable item)
          Adds an object at the beginning of the queue
 void clear()
          Discards all the elements in the queue
protected abstract  boolean doAddAll(Collection<? extends Serializable> items)
          Adds all the items at the end of the queue
protected abstract  void doClear()
          Removes all the items in the queue
protected abstract  Serializable getFirst()
          reads the first element in the queue
 int getSize()
          Return the size of the queue
protected abstract  boolean isEmpty()
           
 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
protected abstract  Serializable removeFirst()
          removes the first element in the queue
protected abstract  int size()
           
 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
 
Methods inherited from interface org.mule.util.queue.QueueStoreDelegate
dispose
 

Constructor Detail

AbstractQueueStoreDelegate

public AbstractQueueStoreDelegate(int capacity)
Method Detail

putNow

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

Specified by:
putNow in interface QueueStoreDelegate

offer

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

Specified by:
offer in interface QueueStoreDelegate
Throws:
InterruptedException

poll

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

Specified by:
poll in interface QueueStoreDelegate
Throws:
InterruptedException

peek

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

Specified by:
peek in interface QueueStoreDelegate
Throws:
InterruptedException

untake

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

Specified by:
untake in interface QueueStoreDelegate
Throws:
InterruptedException

clear

public final void clear()
                 throws InterruptedException
Description copied from interface: QueueStoreDelegate
Discards all the elements in the queue

Specified by:
clear in interface QueueStoreDelegate
Throws:
InterruptedException

addAll

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

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

getSize

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

Specified by:
getSize in interface QueueStoreDelegate

size

protected abstract int size()
Returns:
the number of elements in the queue

getFirst

protected abstract Serializable getFirst()
                                  throws InterruptedException
reads the first element in the queue

Returns:
the fist element in the queue
Throws:
InterruptedException

removeFirst

protected abstract Serializable removeFirst()
                                     throws InterruptedException
removes the first element in the queue

Returns:
the first element in the queue
Throws:
InterruptedException

add

protected abstract void add(Serializable item)
Adds an item at the end of the queue

Parameters:
item - object to add

addFirst

protected abstract void addFirst(Serializable item)
                          throws InterruptedException
Adds an object at the beginning of the queue

Parameters:
item - object to add
Throws:
InterruptedException

doAddAll

protected abstract boolean doAddAll(Collection<? extends Serializable> items)
Adds all the items at the end of the queue

Parameters:
items - objects to add
Returns:
true if it were able to add them all, false otherwise

doClear

protected abstract void doClear()
Removes all the items in the queue


isEmpty

protected abstract boolean isEmpty()
Returns:
true if the queue is empty, false otherwise


Copyright © 2003–2014 MuleSoft, Inc.. All rights reserved.