1/*2 * Licensed to the Apache Software Foundation (ASF) under one3 * or more contributor license agreements. See the NOTICE file4 * distributed with this work for additional information5 * regarding copyright ownership. The ASF licenses this file6 * to you under the Apache License, Version 2.0 (the7 * "License"); you may not use this file except in compliance8 * with the License. You may obtain a copy of the License at9 *10 * http://www.apache.org/licenses/LICENSE-2.011 *12 * Unless required by applicable law or agreed to in writing, software13 * distributed under the License is distributed on an "AS IS" BASIS,14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15 * See the License for the specific language governing permissions and16 * limitations under the License.17 */1819package com.yammer.metrics.core;
2021import java.util.concurrent.TimeUnit;
2223/**24 * An empty Metrics' Meter implementation that does nothing.25 */26publicclassNoOpMeterextends Meter {
27/** singleton instance for everyone to use */28publicstaticfinalNoOpMeter INSTANCE = newNoOpMeter();
2930/** do not instantiate */31privateNoOpMeter() {
32super(newNoOpExecutorService(), "", TimeUnit.SECONDS,
33 Clock.defaultClock());
34 }
3536 @Override
37void tick() { }
3839 @Override
40publicvoid mark() { }
4142 @Override
43publicvoid mark(long n) { }
4445 @Override
46publiclong count() { return 0; }
4748 @Override
49publicdouble fifteenMinuteRate() { return 0.0; }
5051 @Override
52publicdouble fiveMinuteRate() { return 0.0; }
5354 @Override
55publicdouble meanRate() { return 0.0; }
5657 @Override
58publicdouble oneMinuteRate() { return 0.0; }
5960 @Override
61publicvoid stop() { }
6263 @Override
64public <T> void processWith(MetricProcessor<T> processor, MetricName name,
65 T context)
66throws Exception { }
67 }