dropwizard/metrics — pull request #528 by earthling (2014-02-19 22:07:14+00:00)
Title: Make MetricRegistry more amenable to subclassing (without changing RemovalListener interface).

This is a previous [pull request](https://github.com/dropwizard/metrics/pull/516) but with the changes suggested by [ryantenney](https://github.com/ryantenney).

We use Metrics to record many, many short lived and contextual metrics. A best effort is made to remove them from the `MetricRegistry` when possible, but leaks are inevitable. We have a subclass of `MetricRegistry` that provides a `ConcurrentMap` backed by a Guava cache which is bounded in size and also uses weak values. Our `MetricRegistry` subclass implements the `RemovalListener` interface for the cache, but by the time the removal notice is received, the metric is already removed from the cache. We still want to notify `MetricRegistryListener`s so the methods to dispatch the event has been made protected (so that our implementation of the `RemovalListener` may invoke them).

Thank you.