public AdminEnvironment(MutableServletContextHandler handler,
HealthCheckRegistry healthChecks, MetricRegistry metricRegistry) {
super(handler);
this.healthChecks = healthChecks;
this.healthChecks.register("deadlocks", new ThreadDeadlockHealthCheck());
this.tasks = new TaskServlet(metricRegistry);
tasks.add(new GarbageCollectionTask());
addServlet("tasks", tasks).addMapping("/tasks/*");
handler.addLifeCycleListener(new AbstractLifeCycle.AbstractLifeCycleListener() {
@Override
public void lifeCycleStarting(LifeCycle event) {