ahc.collection
Class GenericQueue

java.lang.Object
  |
  +--ahc.collection.GenericQueue
All Implemented Interfaces:
Queue

public class GenericQueue
extends java.lang.Object
implements Queue

This is the generic, configurable implementation of a queue.

Author:
Arno Haase

Constructor Summary
GenericQueue(Store store, AccessStrategy accessStrategy, boolean isThreadSafe)
           
 
Method Summary
 void add(java.lang.Object obj)
           
 void clear()
           
 boolean isEmpty()
           
 boolean isThreadSafe()
           
 java.lang.Object peek()
          This method is implemented only for non-threadsafe queues so that it does not have InterruptedException in its signature.
 java.lang.Object peek(boolean blocking)
           
 java.lang.Object peek(int timeoutMillis)
           
 java.lang.Object remove()
          This method is implemented only for non-threadsafe queues so that it does not have InterruptedException in its signature.
 java.lang.Object remove(boolean blocking)
           
 java.lang.Object remove(int timeoutMillis)
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericQueue

public GenericQueue(Store store,
                    AccessStrategy accessStrategy,
                    boolean isThreadSafe)
Method Detail

add

public void add(java.lang.Object obj)
Specified by:
add in interface Queue

remove

public java.lang.Object remove()
Description copied from interface: Queue
This method is implemented only for non-threadsafe queues so that it does not have InterruptedException in its signature. Therefore, this method does not block but rather throws NoSuchElementException if called on an empty queue.

Specified by:
remove in interface Queue

remove

public java.lang.Object remove(boolean blocking)
                        throws java.lang.InterruptedException
Specified by:
remove in interface Queue
java.lang.InterruptedException

remove

public java.lang.Object remove(int timeoutMillis)
                        throws java.lang.InterruptedException,
                               TimeoutException
Specified by:
remove in interface Queue
java.lang.InterruptedException
TimeoutException

peek

public java.lang.Object peek()
Description copied from interface: Queue
This method is implemented only for non-threadsafe queues so that it does not have InterruptedException in its signature. Therefore, this method does not block but rather throws NoSuchElementException if called on an empty queue.

Specified by:
peek in interface Queue

peek

public java.lang.Object peek(boolean blocking)
                      throws java.lang.InterruptedException
Specified by:
peek in interface Queue
java.lang.InterruptedException

peek

public java.lang.Object peek(int timeoutMillis)
                      throws java.lang.InterruptedException,
                             TimeoutException
Specified by:
peek in interface Queue
java.lang.InterruptedException
TimeoutException

size

public int size()
Specified by:
size in interface Queue

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Queue

clear

public void clear()
Specified by:
clear in interface Queue

isThreadSafe

public boolean isThreadSafe()
Specified by:
isThreadSafe in interface Queue