DATATYPE - The type of the objects in the queue.public class ConcurrentCollectorMultiple<DATATYPE> extends AbstractConcurrentCollector<DATATYPE>
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_PERFORM_COUNT
The default number of objects to be put in the queue for execution.
|
DEFAULT_MAX_QUEUE_SIZE, m_aQueue, STOP_QUEUE_OBJECT| Constructor and Description |
|---|
ConcurrentCollectorMultiple()
Constructor that uses
AbstractConcurrentCollector.DEFAULT_MAX_QUEUE_SIZE elements as the
maximum queue length and DEFAULT_MAX_PERFORM_COUNT as the max
perform count. |
ConcurrentCollectorMultiple(BlockingQueue<Object> aQueue)
Constructor using an existing
BlockingQueue and the default max
perform count (50). |
ConcurrentCollectorMultiple(BlockingQueue<Object> aQueue,
int nMaxPerformCount)
Constructor using an existing
BlockingQueue. |
ConcurrentCollectorMultiple(int nMaxQueueSize,
int nMaxPerformCount)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
collect()
This method starts the collector by taking objects from the internal
BlockingQueue. |
int |
getMaxPerformCount() |
IConcurrentPerformer<List<DATATYPE>> |
getPerformer() |
ConcurrentCollectorMultiple<DATATYPE> |
setPerformer(IConcurrentPerformer<List<DATATYPE>> aPerformer)
Set the performer to be used.
|
drainQueue, getQueueLength, isQueueEmpty, isStopped, queueObject, stopQueuingNewObjectspublic static final int DEFAULT_MAX_PERFORM_COUNT
public ConcurrentCollectorMultiple()
AbstractConcurrentCollector.DEFAULT_MAX_QUEUE_SIZE elements as the
maximum queue length and DEFAULT_MAX_PERFORM_COUNT as the max
perform count.public ConcurrentCollectorMultiple(@Nonnegative int nMaxQueueSize, @Nonnegative int nMaxPerformCount)
nMaxQueueSize - The maximum number of items that can be in the queue. Must be >
0.nMaxPerformCount - The maximum number of objects to be put in the queue for execution.
Must be > 0.public ConcurrentCollectorMultiple(@Nonnull BlockingQueue<Object> aQueue)
BlockingQueue and the default max
perform count (50).aQueue - BlockingQueue to use. May not be null.public ConcurrentCollectorMultiple(@Nonnull BlockingQueue<Object> aQueue, @Nonnegative int nMaxPerformCount)
BlockingQueue.aQueue - BlockingQueue to use. May not be null.nMaxPerformCount - The maximum number of objects to be put in the list for execution.
Must be > 0.@Nonnegative public final int getMaxPerformCount()
@Nullable public final IConcurrentPerformer<List<DATATYPE>> getPerformer()
null if none was explicitly
set.@Nonnull public final ConcurrentCollectorMultiple<DATATYPE> setPerformer(@Nonnull IConcurrentPerformer<List<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.