![JAR search and dependency download from the Maven repository](/logo.png)
io.progix.dropwizard.jooq.JooqHealthCheck Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dropwizard-jooq Show documentation
Show all versions of dropwizard-jooq Show documentation
A Dropwizard bundle for jOOQ integration.
The newest version!
package io.progix.dropwizard.jooq;
import com.codahale.metrics.health.HealthCheck;
import org.jooq.Configuration;
import org.jooq.DSLContext;
import org.jooq.TransactionalCallable;
import org.jooq.TransactionalRunnable;
import org.jooq.exception.DataAccessException;
import org.jooq.impl.DSL;
public class JooqHealthCheck extends HealthCheck {
private final String validationQuery;
private final DSLContext dslContext;
public JooqHealthCheck(DSLContext dslContext, String validationQuery) {
this.validationQuery = validationQuery;
this.dslContext = dslContext;
}
@Override
protected Result check() throws Exception {
Result result = dslContext.transactionResult(new TransactionalCallable() {
@Override
public Result run(Configuration configuration) throws Exception {
dslContext.execute(validationQuery);
return Result.healthy();
}
});
return result;
}
public String getValidationQuery() {
return validationQuery;
}
public DSLContext getDslContext() {
return dslContext;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy