blob: 8752fb15817e9a1f5ce61c6fa3836ce4be565bc7 (
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
32
33
34
35
36
37
38
39
|
// Copyright 2017 Yahoo Holdings. 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.container.di.componentgraph.Provider;
import com.yahoo.jdisc.Metric;
import com.yahoo.jdisc.application.MetricConsumer;
/**
* <p>This class implements a {@link Provider} component of <tt>Metric</tt>. Because this class depends on {@link
* MetricConsumerProvider}, any change to the consumer configuration will trigger reconfiguration of this component,
* which in turn triggers reconfiguration of any component that depends on <tt>Metric</tt>.</p>
*
* @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen Hult</a>
*/
public final class MetricProvider implements Provider<Metric> {
private final Metric metric;
public MetricProvider(MetricConsumerProvider provider) {
metric = new com.yahoo.jdisc.application.MetricProvider(new com.google.inject.Provider<MetricConsumer>() {
@Override
public MetricConsumer get() {
return provider.newInstance();
}
}).get();
}
@Override
public Metric get() {
return metric;
}
@Override
public void deconstruct() {
}
}
|