HADOOP-11105. MetricsSystemImpl could leak memory in registered callbacks. Contributed by Chuan Liu.

(cherry picked from commit 1942364ef14396e9bd94a87c0d901ff9abe1d42a)