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 the queueObject(Object) method).
Author:
Philip Helger
  • Method Details

    • queueObject

      @Nonnull ESuccess queueObject(@Nonnull DATATYPE aObject)
      Submit an object to the queue.
      Parameters:
      aObject - The object to submit. May not be null.
      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 until stopQueuingNewObjects() is new called and the queue is empty.