Interface IMutableConcurrentCollector<DATATYPE>
- Type Parameters:
DATATYPE- The type of objects to be queued
- All Superinterfaces:
IConcurrentCollector
- All Known Implementing Classes:
AbstractConcurrentCollector,ConcurrentCollectorMultiple,ConcurrentCollectorSingle
Base interface for a concurrent queue worker. It asynchronously collects
objects to handle (via the
queueObject(Object) method).- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionvoidcollect()This method starts the collector by taking objects from the internal queue.queueObject(DATATYPE aObject) Submit an object to the queue.Stop taking new objects in the collector.Methods inherited from interface com.helger.commons.concurrent.collector.IConcurrentCollector
getQueueLength, isQueueEmpty, isStopped
-
Method Details
-
queueObject
Submit an object to the queue.- Parameters:
aObject- The object to submit. May not benull.- Returns:
ESuccess- Throws:
IllegalStateException- If the queue is already stopped
-
stopQueuingNewObjects
Stop taking new objects in the collector. Returns directly and does not wait until the processing finished.- Returns:
ESuccess
-
collect
void collect()This method starts the collector by taking objects from the internal queue. So this method blocks and must be invoked from a separate thread. This method runs untilstopQueuingNewObjects()is new called and the queue is empty.
-