DATATYPE - The type of the objects in the queue.public class ConcurrentCollectorSingle<DATATYPE> extends AbstractConcurrentCollector<DATATYPE>
DEFAULT_MAX_QUEUE_SIZE, m_aQueue, STOP_QUEUE_OBJECT| Constructor and Description |
|---|
ConcurrentCollectorSingle()
Constructor that uses
AbstractConcurrentCollector.DEFAULT_MAX_QUEUE_SIZE elements as the
maximum queue length. |
ConcurrentCollectorSingle(BlockingQueue<Object> aQueue)
Constructor using an existing
BlockingQueue. |
ConcurrentCollectorSingle(int nMaxQueueSize)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
collect()
This method starts the collector by taking objects from the internal
BlockingQueue. |
IConcurrentPerformer<DATATYPE> |
getPerformer() |
ConcurrentCollectorSingle<DATATYPE> |
setPerformer(IConcurrentPerformer<DATATYPE> aPerformer)
Set the performer to be used.
|
drainQueue, getQueueLength, isQueueEmpty, isStopped, queueObject, stopQueuingNewObjectspublic ConcurrentCollectorSingle()
AbstractConcurrentCollector.DEFAULT_MAX_QUEUE_SIZE elements as the
maximum queue length.public ConcurrentCollectorSingle(@Nonnegative int nMaxQueueSize)
nMaxQueueSize - The maximum number of items that can be in the queue. Must be >
0.public ConcurrentCollectorSingle(@Nonnull BlockingQueue<Object> aQueue)
BlockingQueue.aQueue - BlockingQueue to use. May not be null.@Nullable public final IConcurrentPerformer<DATATYPE> getPerformer()
null if none was explicitly
set.@Nonnull public final ConcurrentCollectorSingle<DATATYPE> setPerformer(@Nonnull IConcurrentPerformer<DATATYPE> aPerformer)
aPerformer - The performer to be used. May not be null.IllegalStateException - If another performer is already present!public final void collect()
BlockingQueue. So this method blocks and must be invoked from a
separate thread. This method runs until AbstractConcurrentCollector.stopQueuingNewObjects() is
new called and the queue is empty.IllegalStateException - if no performer is set - see
setPerformer(IConcurrentPerformer)Copyright © 2014–2022 Philip Helger. All rights reserved.