Class DefaultProcessorWorkerFactory<InputT,OutputT,MetricsT>
java.lang.Object
io.aleph0.yap.core.worker.DefaultProcessorWorkerFactory<InputT,OutputT,MetricsT>
- Type Parameters:
InputT- the type of the inputOutputT- the type of the outputMetricsT- the type of the metrics
- All Implemented Interfaces:
Measureable<MetricsT>,ProcessorWorkerFactory<InputT,OutputT, MetricsT>
public class DefaultProcessorWorkerFactory<InputT,OutputT,MetricsT>
extends Object
implements ProcessorWorkerFactory<InputT,OutputT,MetricsT>
A
ProcessorWorkerFactory that creates and manages multiple
MeasuredProcessorWorkers and tracks their metrics.
This factory uses a BinaryOperator to aggregate the metrics of all active workers. If
there are no active workers, the metrics will be null. If there is one active worker, the metrics
will be the metrics of that worker. If there are multiple active workers, the metrics will be the
result of applying the BinaryOperator to the metrics of all active workers.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultProcessorWorkerFactory(Supplier<MeasuredProcessorWorker<InputT, OutputT, MetricsT>> workerSupplier, BinaryOperator<MetricsT> metricsAggregator) -
Method Summary
Modifier and TypeMethodDescriptionNon-destructive check of the metrics.Destructive read of the metrics.Creates a newworker
-
Constructor Details
-
DefaultProcessorWorkerFactory
public DefaultProcessorWorkerFactory(Supplier<MeasuredProcessorWorker<InputT, OutputT, MetricsT>> workerSupplier, BinaryOperator<MetricsT> metricsAggregator)
-
-
Method Details
-
newProcessorWorker
Description copied from interface:ProcessorWorkerFactoryCreates a newworker- Specified by:
newProcessorWorkerin interfaceProcessorWorkerFactory<InputT,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<InputT>- 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<InputT>- Returns:
- the metrics
-