HBASE-19810 Fix findbugs and error-prone warnings in hbase-metrics (branch-2)
Signed-off-by: Michael Stack <stack@apache.org>
This commit is contained in:
parent
0561312bc4
commit
4676d4bf4a
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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<MetricRegistry> get(MetricRegistryInfo info) {
|
||||
return Optional.ofNullable(registries.get(info));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<MetricRegistry> getMetricRegistries() {
|
||||
return Collections.unmodifiableCollection(registries.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
registries.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<MetricRegistryInfo> getMetricRegistryInfos() {
|
||||
return Collections.unmodifiableSet(registries.keySet());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue