It seems that the restructuring of the planning mechanism does not occur in the near future.
So, here is how I check the table directly - add group support if you want to:
class QuartzClusterJobStatusService { def quartzScheduler boolean isJobRunning(String job) { return isJobRunningHere(job) || isJobRunningElsewhere(job) } boolean isJobRunningHere(String job) { for (JobExecutionContext j : quartzScheduler.getCurrentlyExecutingJobs()) { if (new JobKey(job,"GRAILS_JOBS").equals(j.jobDetail.key)) { return true } } return false } boolean isJobRunningElsewhere(String job) { JobStoreSupport js = quartzScheduler.sched.resources.jobStore if (!js.isClustered()) { return false } Connection conn = DBConnectionManager.getInstance().getConnection(js.getDataSource()); PreparedStatement stmt = null try { stmt = conn.prepareStatement("SELECT 1 FROM " + js.getTablePrefix() + "FIRED_TRIGGERS where JOB_NAME = ?") stmt.setString(1, job) ResultSet rs = stmt.executeQuery() return rs.next() } finally { if (stmt != null) stmt.close() } } }
Jim p
source share