Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.clustermate.dw;
 
 
Metrics health check for use with DropWizard that checks health of backend store.
public class HealthCheckForStore extends HealthCheck
    protected final Stores<?,?> _stores;
    
    public HealthCheckForStore(ServiceConfig configStores<?,?> stores)
    {
        super();
         = stores;
    }
    @Override
    protected Result check() throws Exception
    {
        // TODO: check basics, like availability of backend data store
        if (.isActive()) {
            return Result.healthy();
        }
        String msg = .getInitProblem();
        if (msg != null) { // failed to start:
            return Result.unhealthy("StorableStore not active since initialization failed: "+msg);
        }
        return Result.unhealthy("StorableStore not active: no init problem set so most likely has been shut down");
    }
New to GrepCode? Check out our FAQ X