public MetricsChainHandler(HttpHandler next, MetricsCollector collector, Deployment deployment) {
this.next = next;
final Map<String, MetricsHandler> servletHandlers = new HashMap<String, MetricsHandler>();
for(Map.Entry<String, ServletHandler> entry : deployment.getServlets().getServletHandlers().entrySet()) {
MetricsHandler handler = new MetricsHandler(next);
servletHandlers.put(entry.getKey(), handler);
collector.registerMetric(entry.getKey(), handler);
}
this.servletHandlers = Collections.unmodifiableMap(servletHandlers);
}