Created
July 16, 2012 14:56
-
-
Save rtrcolin/3123161 to your computer and use it in GitHub Desktop.
Quartz Health Check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.yammer.metrics.core.HealthCheck; | |
import org.quartz.SchedulerException; | |
... | |
public class QuartzHealthCheck extends HealthCheck { | |
private QuartzManager quartzManager; | |
public QuartzSchedulerHealthCheck(QuartzManager qm) throws SchedulerException { | |
super("Quartz Scheduler Health Check"); | |
this.quartzManager = qm; | |
} | |
/** | |
* Checks the state of the Quartz Scheduler and all scheduled Quartz jobs | |
* @return Result Healthy if the scheduler and all of it's jobs are running withing acceptable parameters | |
* @throws Exception if unable to check the state of the scheduler or its jobs | |
*/ | |
@Override | |
protected Result check() throws Exception { | |
// The Quartz is currently in an error state | |
if (!quartzManager.isHealthy()) | |
return Result.unhealthy(quartzManager.getState()); | |
else | |
return Result.healthy(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i found it, thank you.