@Test void testRemovalOfMissingMetricByID() { MetricID metricID = new MetricID("NOT_THERE"); boolean result = registry.remove(metricID); assertThat(result, is(false)); }
@Override public synchronized boolean remove(String name) { final List<MetricID> metricIDs = allMetricIDsByName.get(name); if (metricIDs == null) { return false; } final boolean result = metricIDs.stream() .map(metricID -> allMetrics.remove(metricID) != null) .reduce((a, b) -> a || b) .orElse(false); allMetricIDsByName.remove(name); allMetadata.remove(name); return result; }
Registry extends MetricRegistry { @Override public synchronized boolean remove(String name) { final List<MetricID> metricIDs = allMetricIDsByName.get(name); if (metricIDs == null) { return false; } final boolean result = metricIDs.stream() .map(metricID -> allMetrics.remove(metricID) != null) .reduce((a, b) -> a || b) .orElse(false); allMetricIDsByName.remove(name); allMetadata.remove(name); return result; } }
Registry extends MetricRegistry { @Override public synchronized boolean remove(String name) { final List<MetricID> metricIDs = allMetricIDsByName.get(name); if (metricIDs == null) { return false; } final boolean result = metricIDs.stream() .map(metricID -> allMetrics.remove(metricID) != null) .reduce((a, b) -> a || b) .orElse(false); allMetricIDsByName.remove(name); allMetadata.remove(name); return result; } protected  Registry(Type type); }
Registry extends MetricRegistry { @Override public synchronized boolean remove(String name) { final List<MetricID> metricIDs = allMetricIDsByName.get(name); if (metricIDs == null) { return false; } final boolean result = metricIDs.stream() .map(metricID -> allMetrics.remove(metricID) != null) .reduce((a, b) -> a || b) .orElse(false); allMetricIDsByName.remove(name); allMetadata.remove(name); return result; } protected  Registry(Type type); static Registry create(Type type); @Override T register(String name, T metric); @Override T register(Metadata metadata, T metric); @Override T register(Metadata metadata, T metric, Tag... tags); @Override Counter counter(String name); @Override Counter counter(Metadata metadata); @Override Counter counter(String name, Tag... tags); @Override Counter counter(Metadata metadata, Tag... tags); @Override Histogram histogram(String name); @Override Histogram histogram(Metadata metadata); @Override Histogram histogram(String name, Tag... tags); @Override Histogram histogram(Metadata metadata, Tag... tags); @Override Meter meter(String name); @Override Meter meter(Metadata metadata); @Override Meter meter(String name, Tag... tags); @Override Meter meter(Metadata metadata, Tag... tags); @Override Timer timer(String name); @Override Timer timer(Metadata metadata); @Override Timer timer(String name, Tag... tags); @Override Timer timer(Metadata metadata, Tag... tags); @Override ConcurrentGauge concurrentGauge(String name); @Override ConcurrentGauge concurrentGauge(Metadata metadata); @Override ConcurrentGauge concurrentGauge(String name, Tag... tags); @Override ConcurrentGauge concurrentGauge(Metadata metadata, Tag... tags); @Override SimpleTimer simpleTimer(String name); @Override SimpleTimer simpleTimer(Metadata metadata); @Override SimpleTimer simpleTimer(String name, Tag... tags); @Override SimpleTimer simpleTimer(Metadata metadata, Tag... tags); @Override synchronized boolean remove(String name); @Override synchronized boolean remove(MetricID metricID); @Override void removeMatching(MetricFilter filter); @Override SortedSet<String> getNames(); @Override SortedSet<MetricID> getMetricIDs(); @Override SortedMap<MetricID, Gauge> getGauges(); @Override SortedMap<MetricID, Gauge> getGauges(MetricFilter filter); @Override SortedMap<MetricID, Counter> getCounters(); @Override SortedMap<MetricID, Counter> getCounters(MetricFilter filter); @Override SortedMap<MetricID, Histogram> getHistograms(); @Override SortedMap<MetricID, Histogram> getHistograms(MetricFilter filter); @Override SortedMap<MetricID, Meter> getMeters(); @Override SortedMap<MetricID, Meter> getMeters(MetricFilter filter); @Override SortedMap<MetricID, Timer> getTimers(); @Override SortedMap<MetricID, Timer> getTimers(MetricFilter filter); @Override SortedMap<MetricID, ConcurrentGauge> getConcurrentGauges(); @Override SortedMap<MetricID, ConcurrentGauge> getConcurrentGauges(MetricFilter filter); @Override SortedMap<MetricID, SimpleTimer> getSimpleTimers(); @Override SortedMap<MetricID, SimpleTimer> getSimpleTimers(MetricFilter filter); @Override Map<String, Metadata> getMetadata(); @Override Map<MetricID, Metric> getMetrics(); Optional<Metric> getMetric(String metricName); String type(); boolean empty(); @Override String toString(); synchronized Optional<Map.Entry<? extends Metric, List<MetricID>>> getOptionalMetricWithIDsEntry(String metricName); }
Registry extends MetricRegistry { @Override public synchronized boolean remove(String name) { final List<MetricID> metricIDs = allMetricIDsByName.get(name); if (metricIDs == null) { return false; } final boolean result = metricIDs.stream() .map(metricID -> allMetrics.remove(metricID) != null) .reduce((a, b) -> a || b) .orElse(false); allMetricIDsByName.remove(name); allMetadata.remove(name); return result; } protected  Registry(Type type); static Registry create(Type type); @Override T register(String name, T metric); @Override T register(Metadata metadata, T metric); @Override T register(Metadata metadata, T metric, Tag... tags); @Override Counter counter(String name); @Override Counter counter(Metadata metadata); @Override Counter counter(String name, Tag... tags); @Override Counter counter(Metadata metadata, Tag... tags); @Override Histogram histogram(String name); @Override Histogram histogram(Metadata metadata); @Override Histogram histogram(String name, Tag... tags); @Override Histogram histogram(Metadata metadata, Tag... tags); @Override Meter meter(String name); @Override Meter meter(Metadata metadata); @Override Meter meter(String name, Tag... tags); @Override Meter meter(Metadata metadata, Tag... tags); @Override Timer timer(String name); @Override Timer timer(Metadata metadata); @Override Timer timer(String name, Tag... tags); @Override Timer timer(Metadata metadata, Tag... tags); @Override ConcurrentGauge concurrentGauge(String name); @Override ConcurrentGauge concurrentGauge(Metadata metadata); @Override ConcurrentGauge concurrentGauge(String name, Tag... tags); @Override ConcurrentGauge concurrentGauge(Metadata metadata, Tag... tags); @Override SimpleTimer simpleTimer(String name); @Override SimpleTimer simpleTimer(Metadata metadata); @Override SimpleTimer simpleTimer(String name, Tag... tags); @Override SimpleTimer simpleTimer(Metadata metadata, Tag... tags); @Override synchronized boolean remove(String name); @Override synchronized boolean remove(MetricID metricID); @Override void removeMatching(MetricFilter filter); @Override SortedSet<String> getNames(); @Override SortedSet<MetricID> getMetricIDs(); @Override SortedMap<MetricID, Gauge> getGauges(); @Override SortedMap<MetricID, Gauge> getGauges(MetricFilter filter); @Override SortedMap<MetricID, Counter> getCounters(); @Override SortedMap<MetricID, Counter> getCounters(MetricFilter filter); @Override SortedMap<MetricID, Histogram> getHistograms(); @Override SortedMap<MetricID, Histogram> getHistograms(MetricFilter filter); @Override SortedMap<MetricID, Meter> getMeters(); @Override SortedMap<MetricID, Meter> getMeters(MetricFilter filter); @Override SortedMap<MetricID, Timer> getTimers(); @Override SortedMap<MetricID, Timer> getTimers(MetricFilter filter); @Override SortedMap<MetricID, ConcurrentGauge> getConcurrentGauges(); @Override SortedMap<MetricID, ConcurrentGauge> getConcurrentGauges(MetricFilter filter); @Override SortedMap<MetricID, SimpleTimer> getSimpleTimers(); @Override SortedMap<MetricID, SimpleTimer> getSimpleTimers(MetricFilter filter); @Override Map<String, Metadata> getMetadata(); @Override Map<MetricID, Metric> getMetrics(); Optional<Metric> getMetric(String metricName); String type(); boolean empty(); @Override String toString(); synchronized Optional<Map.Entry<? extends Metric, List<MetricID>>> getOptionalMetricWithIDsEntry(String metricName);  }