From 4676d4bf4a86e94104b7432d24916baa31699706 Mon Sep 17 00:00:00 2001 From: Peter Somogyi Date: Wed, 17 Jan 2018 10:05:03 +0100 Subject: [PATCH] HBASE-19810 Fix findbugs and error-prone warnings in hbase-metrics (branch-2) Signed-off-by: Michael Stack --- .../org/apache/hadoop/hbase/metrics/impl/HistogramImpl.java | 2 ++ .../hadoop/hbase/metrics/impl/MetricRegistriesImpl.java | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/HistogramImpl.java b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/HistogramImpl.java index 6871f7e7b8b..7b79fba50f1 100644 --- a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/HistogramImpl.java +++ b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/HistogramImpl.java @@ -65,6 +65,7 @@ public class HistogramImpl implements Histogram { histogram.add(value, 1); } + @Override public long getCount() { return counter.getCount(); } @@ -73,6 +74,7 @@ public class HistogramImpl implements Histogram { return this.histogram.getMax(); } + @Override public Snapshot snapshot() { return histogram.snapshotAndReset(); } diff --git a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistriesImpl.java b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistriesImpl.java index d72c68f61e6..3826e66093b 100644 --- a/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistriesImpl.java +++ b/hbase-metrics/src/main/java/org/apache/hadoop/hbase/metrics/impl/MetricRegistriesImpl.java @@ -51,22 +51,27 @@ public class MetricRegistriesImpl extends MetricRegistries { return registries.put(info, () -> factory.create(info)); } + @Override public boolean remove(MetricRegistryInfo key) { return registries.remove(key) == null; } + @Override public Optional get(MetricRegistryInfo info) { return Optional.ofNullable(registries.get(info)); } + @Override public Collection getMetricRegistries() { return Collections.unmodifiableCollection(registries.values()); } + @Override public void clear() { registries.clear(); } + @Override public Set getMetricRegistryInfos() { return Collections.unmodifiableSet(registries.keySet()); }