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

com.custardsource.parfait.spring.SelfStartingMonitoringView Maven / Gradle / Ivy

Go to download

Library enabling parfait timing collection around Spring beans using Spring AOP

There is a newer version: 0.3.11
Show newest version
package com.custardsource.parfait.spring;

import com.custardsource.parfait.DynamicMonitoringView;
import com.custardsource.parfait.MonitorableRegistry;
import com.custardsource.parfait.MonitoringView;
import org.springframework.context.Lifecycle;

/**
 * Adapter between a normal MonitoringView and Spring's Lifecycle interface (which conveniently has the exact-same
 * methods).
 */
public class SelfStartingMonitoringView implements Lifecycle {

    private final DynamicMonitoringView dynamicMonitoringView;

    public SelfStartingMonitoringView(DynamicMonitoringView dynamicMonitoringView) {
        this.dynamicMonitoringView = dynamicMonitoringView;
    }

    /**
     * @deprecated,
     * Use SelfStartingMonitoringView(DynamicMonitoringView dynamicMonitoringView) instead.
     */
    @Deprecated
    public SelfStartingMonitoringView(MonitoringView monitoringView) {
        dynamicMonitoringView = new DynamicMonitoringView(monitoringView);
    }

    /**
     * @deprecated,
     * Use SelfStartingMonitoringView(DynamicMonitoringView dynamicMonitoringView) instead.
     */
    @Deprecated
    public SelfStartingMonitoringView(MonitoringView monitoringView, final long quietPeriodInMillis) {
        dynamicMonitoringView = new DynamicMonitoringView(monitoringView, quietPeriodInMillis);
    }

    /**
     * @deprecated,
     * Use SelfStartingMonitoringView(DynamicMonitoringView dynamicMonitoringView) instead.
     */
    @Deprecated
    public SelfStartingMonitoringView(MonitorableRegistry registry, MonitoringView monitoringView) {
        dynamicMonitoringView = new DynamicMonitoringView(registry, monitoringView);
    }

    /**
     * @deprecated,
     * Use SelfStartingMonitoringView(DynamicMonitoringView dynamicMonitoringView) instead.
     */
    @Deprecated
    public SelfStartingMonitoringView(MonitorableRegistry registry, MonitoringView monitoringView, final long quietPeriodInMillis) {
        dynamicMonitoringView = new DynamicMonitoringView(registry, monitoringView, quietPeriodInMillis);
    }

    @Override
    public void start() {
        dynamicMonitoringView.start();
    }

    @Override
    public void stop() {
        dynamicMonitoringView.stop();
    }

    @Override
    public boolean isRunning() {
        return dynamicMonitoringView.isRunning();
    }

    public static final long defaultQuietPeriod() {
        return DynamicMonitoringView.defaultQuietPeriod();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy