Package org.marketcetera.modules.async
Class SimpleAsyncProcessor.DataFlowHandler
- java.lang.Object
-
- org.marketcetera.modules.async.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 Summary
Fields Modifier and Type Field Description private BlockingQueue<Object>mDataQueueThe queue that receives data from the upstream module.private DataEmitterSupportmEmitterSupportThe emitter support instance used for publishing data.private Future<?>mFutureThe future for tracking this task.
-
Constructor Summary
Constructors Constructor Description DataFlowHandler(DataEmitterSupport inEmitterSupport)Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) Future<?>getFuture()Gets the future that can be used to track this handler's execution.(package private) intgetQueueSize()Returns the total number of unprocessed data items in the queue.(package private) voidreceiveData(Object inData)Supplies a received data item to the handler.voidrun()(package private) voidsetFuture(Future<?> inFuture)Sets the future that was obtained after submitting this task to the thread pool.
-
-
-
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
-
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.
-
-