aboutsummaryrefslogtreecommitdiffstats
path: root/container-disc/src/main/java/com/yahoo/container/jdisc/metric/DisableGuiceMetric.java
blob: c259155b6a39238187e708d9135acbed9e0734e7 (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
// Copyright Vespa.ai. 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.jdisc.Metric;

import java.util.Map;

/**
 * @author Tony Vaagenes
 */
public class DisableGuiceMetric implements Metric {

    @Override
    public void set(String s, Number number, Context context) {
        throw newException();
    }

    @Override
    public void add(String s, Number number, Context context) {
        throw newException();
    }

    @Override
    public Context createContext(Map<String, ?> stringMap) {
        throw newException();
    }

    private static RuntimeException newException() {
        return new UnsupportedOperationException("The Metric framework is only available to components.");
    }

}