Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package io.dropwizard.setup;
import static;
import static;

The administrative environment of a Dropwizard application.
public class AdminEnvironment extends ServletEnvironment {
    private static final Logger LOGGER = LoggerFactory.getLogger(AdminEnvironment.class);
    private final HealthCheckRegistry healthChecks;
    private final TaskServlet tasks;

Creates a new AdminEnvironment.

handler a servlet context handler
healthChecks a health check registry
                            HealthCheckRegistry healthChecksMetricRegistry metricRegistry) {
        this. = healthChecks;
        this..register("deadlocks"new ThreadDeadlockHealthCheck());
        this. = new TaskServlet(metricRegistry);
        .add(new GarbageCollectionTask());
        .add(new LogConfigurationTask());
            public void lifeCycleStarting(LifeCycle event) {

Adds the given task to the set of tasks exposed via the admin interface.

task a task
    public void addTask(Task task) {
    private void logTasks() {
        final StringBuilder stringBuilder = new StringBuilder(1024).append(String.format("%n%n"));
        for (Task task : .getTasks()) {
            final String taskClassName = firstNonNull(task.getClass().getCanonicalName(), task.getClass().getName());
            stringBuilder.append(String.format("    %-7s /tasks/%s (%s)%n",
        .info("tasks = {}"stringBuilder.toString());
    private void logHealthChecks() {
        if (.getNames().size() <= 1) {
                    "%n" +
                            "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!%n" +
                            "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!%n" +
                            "!    THIS APPLICATION HAS NO HEALTHCHECKS. THIS MEANS YOU WILL NEVER KNOW      !%n" +
                            "!     IF IT DIES IN PRODUCTION, WHICH MEANS YOU WILL NEVER KNOW IF YOU'RE      !%n" +
                            "!    LETTING YOUR USERS DOWN. YOU SHOULD ADD A HEALTHCHECK FOR EACH OF YOUR    !%n" +
                            "!         APPLICATION'S DEPENDENCIES WHICH FULLY (BUT LIGHTLY) TESTS IT.       !%n" +
                            "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!%n" +
        .debug("health checks = {}".getNames());
New to GrepCode? Check out our FAQ X