Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package io.dropwizard.jdbi;
 
public class DBIHealthCheck extends HealthCheck {
    private final DBI dbi;
    private final String validationQuery;
    
    public DBIHealthCheck(ExecutorService executorServiceDuration durationDBI dbiString validationQuery) {
        this. = dbi;
        this. = validationQuery;
        this. = new TimeBoundHealthCheck(executorServiceduration);
    }
    
    public DBIHealthCheck(DBI dbiString validationQuery) {
        this(MoreExecutors.newDirectExecutorService(), Duration.seconds(0), dbivalidationQuery);
    }
    @Override
    protected Result check() throws Exception {
        return .check(new Callable<Result>() {
            @Override
            public Result call() throws Exception {
                try (Handle handle = .open()) {
                    handle.execute();
                    return Result.healthy();
                }
            }
        });
    }
New to GrepCode? Check out our FAQ X