DATATYPE - The type of the objects in the queue.public abstract class AbstractConcurrentCollector<DATATYPE> extends Object implements INonThrowingRunnable, IMutableConcurrentCollector<DATATYPE>
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_QUEUE_SIZE
Default maximum queue size
|
protected BlockingQueue<Object> |
m_aQueue |
protected static Object |
STOP_QUEUE_OBJECT |
| Constructor and Description |
|---|
AbstractConcurrentCollector(int nMaxQueueSize)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getQueueLength() |
boolean |
isQueueEmpty() |
boolean |
isStopped()
Check if this collector is already stopped.
|
ESuccess |
queueObject(DATATYPE aObject)
Submit an object to the queue.
|
ESuccess |
stopQueuingNewObjects()
Stop taking new objects in the collector.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitrunpublic static final int DEFAULT_MAX_QUEUE_SIZE
protected static final Object STOP_QUEUE_OBJECT
protected final BlockingQueue<Object> m_aQueue
public AbstractConcurrentCollector(@Nonnegative int nMaxQueueSize)
nMaxQueueSize - The maximum number of items that can be in the queue. Must be >
0.@Nonnull public final ESuccess queueObject(@Nonnull DATATYPE aObject)
IMutableConcurrentCollectorqueueObject in interface IMutableConcurrentCollector<DATATYPE>aObject - The object to submit. May not be null.ESuccesspublic boolean isQueueEmpty()
isQueueEmpty in interface IConcurrentCollector<DATATYPE>true if the queue is empty, false
otherwise.@Nonnegative public final int getQueueLength()
getQueueLength in interface IConcurrentCollector<DATATYPE>@Nonnull public final ESuccess stopQueuingNewObjects()
IMutableConcurrentCollectorstopQueuingNewObjects in interface IMutableConcurrentCollector<DATATYPE>ESuccesspublic final boolean isStopped()
IConcurrentCollectorisStopped in interface IConcurrentCollector<DATATYPE>true if the collector is stopped, false
otherwise.Copyright © 2014–2015 Philip Helger. All rights reserved.