|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.deepthought.sidious.util.SidiousQueue<T>
@ThreadSafe public abstract class SidiousQueue<T>
Abstract representation of a queue which uses a thread to dequeue and process elements.
Implements a work queue; which allows for asynchronous processing of enqueued items.
Nested Class Summary | |
---|---|
private class |
SidiousQueue.InternalThread
Private thread implementation. |
Field Summary | |
---|---|
private boolean |
interrupted
Boolean to indicate whether the thread has been interrupted. |
private static org.apache.commons.logging.Log |
logger
Logger for this class |
private java.util.List<T> |
queue
Internal queue. |
Constructor Summary | |
---|---|
protected |
SidiousQueue(java.lang.String name)
Constructor that starts a new thread. |
Method Summary | |
---|---|
void |
enqueue(T item)
Enqueues an item. |
void |
interrupt()
Interrupts the thread. |
protected abstract void |
process(T item)
The processing of an item. |
private void |
startThread(java.lang.String name)
Method to start the thread. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final org.apache.commons.logging.Log logger
private boolean interrupted
private final java.util.List<T> queue
Constructor Detail |
---|
protected SidiousQueue(java.lang.String name)
Method Detail |
---|
public final void enqueue(T item)
item
- the item to be enqueuedpublic final void interrupt()
protected abstract void process(T item)
item
- the item to be processed.private void startThread(java.lang.String name)
name
- the name of the thread
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |