All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ow2.petals.probes.api.ProbesFactory Maven / Gradle / Ivy

/**
 * Copyright (c) 2012-2016 Linagora
 * 
 * This program/library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 2.1 of the License, or (at your
 * option) any later version.
 * 
 * This program/library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program/library; If not, see http://www.gnu.org/licenses/
 * for the GNU Lesser General Public License version 2.1.
 */
package org.ow2.petals.probes.api;

import java.util.Timer;

import org.ow2.petals.probes.api.probes.CounterGaugeProbe;
import org.ow2.petals.probes.api.probes.CounterProbe;
import org.ow2.petals.probes.api.probes.DurationProbe;
import org.ow2.petals.probes.api.probes.GaugeProbe;
import org.ow2.petals.probes.api.sensor.GaugeSensor;
import org.ow2.petals.probes.api.sensor.detector.GaugeDefectDetector;

/**
 * Probe factory.
 * 
 * @param 
 *            The type of measured values (internal value type).
 * @param 
 *            The type of value to return to client probe (external value type).
 * 
 * @author Christophe DENEUX (Linagora)
 */
public interface ProbesFactory, S> {

    /**
     * Create a new counter probe instance.
     * 
     * @see {@link CounterProbe}
     */
    public CounterProbe createCounterProbe();

    /**
     * Create a new counter gauge probe instance.
     * 
     * @param initialValue
     *            Initial value of the counter gauge.
     * @see {@link CounterGaugeProbe}
     */
    public CounterGaugeProbe createCounterGaugeProbe(final long initialValue);

    /**
     * Create a new gauge probe instance using a specific sensor.
     * 
     * @param sensor
     *            The sensor of the probe
     * 
     * @see {@link GaugeProbe}
     */
    public GaugeProbe createGaugeProbe(final GaugeSensor sensor);

    /**
     * Create a new gauge probe instance using a specific sensor and a defect
     * detector.
     * 
     * @param sensor
     *            The sensor of the probe
     * @param defectDetector
     *            The defect detector associated to the sensor.
     * 
     * @see {@link GaugeProbe}
     */
    public GaugeProbe createGaugeProbe(final GaugeSensor sensor,
            final GaugeDefectDetector defectDetector);

    /**
     * Create a new duration probe instance, where durations are expressed in milliseconds.
     * 
     * @param timer
     *            The {@link Timer} running the samples switches task
     * @param samplePeriod
     *            Duration between two samples switches
     * @throws IllegalArgumentException
     *             timer is null, or samplePeriod has an invalid value.
     * @see {@link DurationProbe}
     */
    public DurationProbe createDurationProbe(final Timer timer, final long samplePeriod)
            throws IllegalArgumentException;

    /**
     * Create a new duration probe instance, where durations are expressed in nanoseconds.
     * 
     * @param timer
     *            The {@link Timer} running the samples switches task
     * @param samplePeriod
     *            Duration between two samples switches
     * @throws IllegalArgumentException
     *             timer is null, or samplePeriod has an invalid value.
     * @see {@link DurationProbe}
     */
    public DurationProbe createDurationNanoProbe(final Timer timer, final long samplePeriod)
            throws IllegalArgumentException;

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy