// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.feedhandler;
import com.yahoo.jdisc.Metric;
import java.util.Map;
/**
* @author Einar M R Rosenvinge
* @since 5.1.20
*/
public final class NullFeedMetric implements Metric {
public NullFeedMetric(boolean flag) {
if (!flag) {
throw new IllegalArgumentException("must set flag allowing to throw away metrics");
}
}
@Override
public void set(String key, Number val, Context ctx) {
}
@Override
public void add(String key, Number val, Context ctx) {
}
@Override
public Context createContext(Map properties) {
return NullFeedContext.INSTANCE;
}
private static class NullFeedContext implements Context {
private static final NullFeedContext INSTANCE = new NullFeedContext();
}
}