Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.yammer.metrics.core;
 
 
A registry for health checks.
public class HealthCheckRegistry {
    private final ConcurrentMap<StringHealthCheckhealthChecks = new ConcurrentHashMap<StringHealthCheck>();

    
Registers an application HealthCheck.

Parameters:
healthCheck the HealthCheck instance
    public void register(HealthCheck healthCheck) {
        .putIfAbsent(healthCheck.getName(), healthCheck);
    }

    
Unregisters the application HealthCheck with the given name.

Parameters:
name the name of the HealthCheck instance
    public void unregister(String name) {
        .remove(name);
    }

    
Unregisters the given HealthCheck.

Parameters:
healthCheck a HealthCheck
    public void unregister(HealthCheck healthCheck) {
        unregister(healthCheck.getName());
    }

    
Runs the registered health checks and returns a map of the results.

Returns:
a map of the health check results
    public SortedMap<StringResultrunHealthChecks() {
        final SortedMap<StringResultresults = new TreeMap<StringResult>();
        for (Entry<StringHealthCheckentry : .entrySet()) {
            final Result result = entry.getValue().execute();
            results.put(entry.getKey(), result);
        }
        return Collections.unmodifiableSortedMap(results);
    }
New to GrepCode? Check out our FAQ X