Class SimpleAsyncProcessor.DataFlowHandler

  • All Implemented Interfaces:
    Runnable
    Enclosing class:
    SimpleAsyncProcessor

    private static class SimpleAsyncProcessor.DataFlowHandler
    extends Object
    implements Runnable
    Instances of this class keep track of the queue of data items accumulated for the data flow and the thread that is responsible for processing those items.
    • Field Detail

      • mEmitterSupport

        private final DataEmitterSupport mEmitterSupport
        The emitter support instance used for publishing data.
      • mDataQueue

        private final BlockingQueue<Object> mDataQueue
        The queue that receives data from the upstream module. The handler removes data from this queue and publishes it to the downstream module.
      • mFuture

        private Future<?> mFuture
        The future for tracking this task.
    • Constructor Detail

      • DataFlowHandler

        DataFlowHandler​(DataEmitterSupport inEmitterSupport)
        Creates an instance.
        Parameters:
        inEmitterSupport - the emitter support instance to emit data for the data flow.
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface Runnable
      • getQueueSize

        int getQueueSize()
        Returns the total number of unprocessed data items in the queue.
        Returns:
        the total number of unprocessed data items in the queue.
      • receiveData

        void receiveData​(Object inData)
        Supplies a received data item to the handler. The provided data item is added to the queue of unprocessed items.
        Parameters:
        inData - the data item received.
      • getFuture

        Future<?> getFuture()
        Gets the future that can be used to track this handler's execution.
        Returns:
        the future for this handler.
      • setFuture

        void setFuture​(Future<?> inFuture)
        Sets the future that was obtained after submitting this task to the thread pool.
        Parameters:
        inFuture - the future obtained after submitting this task to the thread pool.