aboutsummaryrefslogtreecommitdiffstats
path: root/container-disc/src/main/java/com/yahoo/container/jdisc/metric/MetricConsumerProviderProvider.java
blob: f765397446ad2911154586707d1a7bef99a92f81 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.jdisc.metric;

import com.yahoo.component.annotation.Inject;
import com.yahoo.component.provider.ComponentRegistry;
import com.yahoo.container.di.componentgraph.Provider;
import com.yahoo.container.jdisc.MetricConsumerFactory;

/**
 * A dependency injection provider which provides the default metrics provider
 * if no provider is set up explicitly in the application package.
 * The purpose of this is to be a fallback if nothing is set up explicitly.
 *
 * @author bratseth
 */
public class MetricConsumerProviderProvider implements Provider<MetricConsumerProvider> {

    private final MetricConsumerProvider provided;

    @Inject
    public MetricConsumerProviderProvider(ComponentRegistry<MetricConsumerFactory> factoryRegistry) {
        provided = new MetricConsumerProvider(factoryRegistry);
    }

    @Override
    public MetricConsumerProvider get() { return provided; }

    @Override
    public void deconstruct() { }

}