Interface IMutableConcurrentCollector<DATATYPE>
-
- Type Parameters:
DATATYPE- The type of objects to be queued
- All Superinterfaces:
IConcurrentCollector
- All Known Implementing Classes:
AbstractConcurrentCollector,ConcurrentCollectorMultiple,ConcurrentCollectorSingle
public interface IMutableConcurrentCollector<DATATYPE> extends IConcurrentCollector
Base interface for a concurrent queue worker. It asynchronously collects objects to handle (via thequeueObject(Object)method).- Author:
- Philip Helger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcollect()This method starts the collector by taking objects from the internal queue.ESuccessqueueObject(DATATYPE aObject)Submit an object to the queue.ESuccessstopQueuingNewObjects()Stop taking new objects in the collector.-
Methods inherited from interface com.helger.commons.concurrent.collector.IConcurrentCollector
getQueueLength, isQueueEmpty, isStopped
-
-
-
-
Method Detail
-
queueObject
@Nonnull ESuccess queueObject(@Nonnull DATATYPE aObject)
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
@Nonnull ESuccess 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.
-
-