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 IntervalBasedScheduler<T extends MeasurementType<Object>,D extends DataPoint> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected ServiceStatus |
status
lifecycle status of the scheduler itself
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract <L,MT extends MeasurementType<L>> |
createJob(SamplingService<L> endpointService,
Collection<MeasurementInstance<L,MT>> instances,
Consumer<D> completionHandler) |
static IntervalBasedScheduler<AvailType<Object>,AvailDataPoint> |
forAvails(String name,
int schedulerThreads,
Consumer<AvailDataPoint> completionHandler)
Static method that builds a scheduler (along with its thread pool) for availability checking.
|
static IntervalBasedScheduler<MetricType<Object>,MetricDataPoint> |
forMetrics(String name,
int schedulerThreads,
Consumer<MetricDataPoint> completionHandler)
Static method that builds a scheduler (along with its thread pool) for metric collection.
|
protected abstract <L,MT extends MeasurementType<L>> |
getMeasurementInstances(Resource<L> resource) |
<L,TT extends MeasurementType<L>> |
rescheduleAll(SamplingService<L> endpointService,
List<Resource<L>> resources)
This will reschedule all metric collection and avail checking jobs for the given endpoint.
|
<L,TT extends MeasurementType<L>> |
schedule(SamplingService<L> endpointService,
List<Resource<L>> resources)
Schedules metric collections and avail checks for the given resources.
|
void |
start() |
void |
stop() |
<L,TT extends MeasurementType<L>> |
unschedule(SamplingService<L> endpointService,
List<Resource<L>> resources)
Removes any existing metric collections and avail checks that are scheduled for the given resources.
|
protected volatile ServiceStatus status
public static IntervalBasedScheduler<MetricType<Object>,MetricDataPoint> forMetrics(String name, int schedulerThreads, Consumer<MetricDataPoint> completionHandler)
name - the name of the scheduler (used for things like naming the threads)schedulerThreads - number of core threads in the thread poolcompletionHandler - object that is notified of metric values when they are collectedpublic static IntervalBasedScheduler<AvailType<Object>,AvailDataPoint> forAvails(String name, int schedulerThreads, Consumer<AvailDataPoint> completionHandler)
name - the name of the scheduler (used for things like naming the threads)schedulerThreads - number of core threads in the thread poolcompletionHandler - object that is notified of availability results when they are checkedpublic <L,TT extends MeasurementType<L>> void rescheduleAll(SamplingService<L> endpointService, List<Resource<L>> resources)
endpointService - defines where the resources areresources - the resources whose metric collections/avail checks are to be rescheduledpublic <L,TT extends MeasurementType<L>> void schedule(SamplingService<L> endpointService, List<Resource<L>> resources)
rescheduleAll(SamplingService, List), this method keeps currently scheduled jobs
in place.endpointService - defines where the resources areresources - the resources whose metric collections/avail checks are to be added to the schedulerpublic <L,TT extends MeasurementType<L>> void unschedule(SamplingService<L> endpointService, List<Resource<L>> resources)
rescheduleAll(SamplingService, List), this method keeps other currently scheduled jobs
in place.endpointService - defines where the resources areresources - the resources whose metric collections/avail checks are to be removed from the schedulerprotected abstract <L,MT extends MeasurementType<L>> Runnable createJob(SamplingService<L> endpointService, Collection<MeasurementInstance<L,MT>> instances, Consumer<D> completionHandler)
protected abstract <L,MT extends MeasurementType<L>> Collection<MeasurementInstance<L,MT>> getMeasurementInstances(Resource<L> resource)
public void start()
public void stop()
Copyright © 2015 Red Hat, Inc.. All rights reserved.