K - public class HandlerQueueTuple<K extends TurbineData>
extends java.lang.Object
TurbineDataHandler to receive data from multiple producers.
The HandlerQueueTuple object uses an EventQueue implementation to protect the publishers
from a slow listener. It also employs a number of threads needed to poll repeatedly from the EventQueue
and dispatch to the handler underneath. If the EventQueue is full then pushData(Collection) simply fails fast and moves on.
Note that the max queue size and the number of threads will help determine the throughput of a handler, and hence must be carefully chosen.
The AggregateClusterMonitor employs this object to receive and aggregate data from multiple InstanceMonitor objects.
The aggregator can in turn also dispatch data to TurbineDataHandler underneath using a HandlerQueueTuple for each handler as well,
thus decoupling the performance of the aggregator from any potentially slow listener.
| Modifier and Type | Class and Description |
|---|---|
static class |
HandlerQueueTuple.UnitTest |
| Constructor and Description |
|---|
HandlerQueueTuple(TurbineDataHandler<K> eventHandler) |
| Modifier and Type | Method and Description |
|---|---|
TurbineDataHandler<K> |
getHandler() |
EventQueue<K> |
getQueue() |
boolean |
previouslyStopped()
Helper method to identify if the tuple has been requested to stop
|
void |
pushData(java.util.Collection<K> statsData)
Send data to the tuple
|
void |
pushData(K data) |
boolean |
running()
Helper to identify if the tuple is still running
|
void |
start()
Starts the poller threads and this causes the eventhandler to start receiving data via the
TurbineDataHandler.handleData(Collection) method. |
void |
stop()
Stops all the poller threads, and the event handler will stop receiving data.
|
java.lang.String |
toString() |
public HandlerQueueTuple(TurbineDataHandler<K> eventHandler)
eventHandler - public void start()
throws java.lang.Exception
TurbineDataHandler.handleData(Collection) method.java.lang.Exceptionpublic void stop()
public boolean previouslyStopped()
public boolean running()
public TurbineDataHandler<K> getHandler()
TurbineDataHandlerpublic EventQueue<K> getQueue()
EventQueuepublic void pushData(java.util.Collection<K> statsData)
statsData - public void pushData(K data)
data - public java.lang.String toString()
toString in class java.lang.Object