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 com.yammer.metrics.stats.Snapshot;
2223/**24 * An empty Metrics' Histogram that does nothing.25 */26publicclassNoOpHistogramextends Histogram {
27/** singleton instance for everyone to use */28publicstaticfinalNoOpHistogram INSTANCE = newNoOpHistogram();
2930/** do not instantiate */31privateNoOpHistogram() { super(SampleType.UNIFORM); }
3233 @Override
34publicvoid clear() { }
3536 @Override
37publicvoid update(int value) { }
3839 @Override
40publicvoid update(long value) { }
4142 @Override
43publiclong count() { return 0; }
4445 @Override
46publicdouble max() { return 0.0; }
4748 @Override
49publicdouble min() { return 0.0; }
5051 @Override
52publicdouble mean() { return 0.0; }
5354 @Override
55publicdouble stdDev() { return 0.0; }
5657 @Override
58publicdouble sum() { return 0.0; }
5960 @Override
61public Snapshot getSnapshot() { returnnew Snapshot(newdouble[0]); }
6263 @Override
64public <T> void processWith(MetricProcessor<T> processor, MetricName name,
65 T context)
66throws Exception { }
67 }