Class SingletonProducerWorkerFactory<OutputT,MetricsT>
java.lang.Object
io.aleph0.yap.core.worker.SingletonProducerWorkerFactory<OutputT,MetricsT>
- Type Parameters:
OutputT- the type of the worker's outputMetricsT- the type of the worker's metrics
- All Implemented Interfaces:
Measureable<MetricsT>,ProducerWorkerFactory<OutputT,MetricsT>
public class SingletonProducerWorkerFactory<OutputT,MetricsT>
extends Object
implements ProducerWorkerFactory<OutputT,MetricsT>
A
ProducerWorkerFactory that manages a singleton MeasuredProducerWorker and
tracks its metrics.
This factory will only create one worker, for which it will return
its given worker. All subsequent attempts to create a worker will throw an
IllegalStateException.
-
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionNon-destructive check of the metrics.Destructive read of the metrics.Creates a newworker
-
Constructor Details
-
SingletonProducerWorkerFactory
-
-
Method Details
-
newProducerWorker
Description copied from interface:ProducerWorkerFactoryCreates a newworker- Specified by:
newProducerWorkerin interfaceProducerWorkerFactory<OutputT,MetricsT> - Returns:
- the new worker
-
checkMetrics
Description copied from interface:MeasureableNon-destructive check of the metrics. This should be used to check the state of metrics without clearing them, for example in aTaskController.- Specified by:
checkMetricsin interfaceMeasureable<OutputT>- Returns:
- the metrics
-
flushMetrics
Description copied from interface:MeasureableDestructive read of the metrics. This should be used to check and reset the state of metrics, for example by the metrics checking thread.- Specified by:
flushMetricsin interfaceMeasureable<OutputT>- Returns:
- the metrics
-