From 8bdf825e164469f4a3f22a2d6e92e799c02b9f6e Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 23 Apr 2019 14:35:44 +0200 Subject: Move the NullFeedMetric too where it is used. --- .../com/yahoo/feedhandler/v3/NullFeedMetric.java | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/v3/NullFeedMetric.java (limited to 'vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/v3/NullFeedMetric.java') diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/v3/NullFeedMetric.java b/vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/v3/NullFeedMetric.java new file mode 100644 index 00000000000..4777c6c7b99 --- /dev/null +++ b/vespaclient-container-plugin/src/test/java/com/yahoo/feedhandler/v3/NullFeedMetric.java @@ -0,0 +1,35 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.feedhandler.v3; + +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(); + } +} -- cgit v1.2.3