T - the sublclass of MeasurementType to handle (such as metric types or avail types)D - the DataPoint type (such as metric data or avail data)public abstract class MeasurementScheduler<L,T extends MeasurementType<L>,D extends DataPoint> extends Object
#forMetrics(String, int, Consumer) or #forAvails(String, int, Consumer).| Modifier and Type | Field and Description |
|---|---|
protected ServiceStatus |
status
lifecycle status of the scheduler itself
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract Runnable |
createCollector(SamplingService<L> endpointService,
ScheduledCollectionsQueue<L,T> queue,
Consumer<D> completionHandler)
Creates the object that will be responsible for collecting the data;
|
static <LL> MeasurementScheduler<LL,AvailType<LL>,AvailDataPoint> |
forAvails(String name,
Consumer<AvailDataPoint> completionHandler)
Static method that builds a scheduler for availability checking.
|
static <LL> MeasurementScheduler<LL,MetricType<LL>,MetricDataPoint> |
forMetrics(String name,
Consumer<MetricDataPoint> completionHandler)
Static method that builds a scheduler for metric collection.
|
protected abstract Collection<ScheduledMeasurementInstance<L,T>> |
getScheduledMeasurementInstances(Resource<L> resource)
Given a resource, this returns the measurement instances that this scheduler should collect for it.
|
void |
schedule(SamplingService<L> endpointService,
Collection<Resource<L>> resources)
Schedules collections for all measurements for the given resources.
|
void |
start() |
void |
stop() |
void |
unschedule(SamplingService<L> endpointService,
Collection<Resource<L>> resources)
Removes any existing collections that are scheduled for the given resources.
|
protected volatile ServiceStatus status
public static <LL> MeasurementScheduler<LL,MetricType<LL>,MetricDataPoint> forMetrics(String name, Consumer<MetricDataPoint> completionHandler)
name - the name of the scheduler (used for things like naming the threads)completionHandler - object that is notified of metric values when they are collectedpublic static <LL> MeasurementScheduler<LL,AvailType<LL>,AvailDataPoint> forAvails(String name, Consumer<AvailDataPoint> completionHandler)
name - the name of the scheduler (used for things like naming the threads)completionHandler - object that is notified of availability results when they are checkedpublic void schedule(SamplingService<L> endpointService, Collection<Resource<L>> resources)
endpointService - defines where the resources areresources - the resources whose metric collections/avail checks are to be added to the schedulerpublic void unschedule(SamplingService<L> endpointService, Collection<Resource<L>> resources)
endpointService - defines where the resources areresources - the resources whose metric collections/avail checks are to be removed from the schedulerpublic void start()
public void stop()
protected abstract Runnable createCollector(SamplingService<L> endpointService, ScheduledCollectionsQueue<L,T> queue, Consumer<D> completionHandler)
endpointService - the resources whose data is to be collected are managed by this endpointqueue - contains the scheduled measurementscompletionHandler - handler to process the measurement collection resultsprotected abstract Collection<ScheduledMeasurementInstance<L,T>> getScheduledMeasurementInstances(Resource<L> resource)
resource - the resource whose measurement instances are to be returnedCopyright © 2015–2017 Red Hat, Inc.. All rights reserved.