private QuartzJobDetail makeJobDetail(CascadingClassLoadHelper cascadingClassLoadHelper, ResultSet rs) throws SQLException, ClassNotFoundException, IOException { JobDetailImpl jobDetail = new JobDetailImpl(); String groupName = rs.getString(Constants.COL_JOB_GROUP); String jobName = rs.getString(Constants.COL_JOB_NAME); jobDetail.setName(jobName); jobDetail.setGroup(groupName); jobDetail.setDescription(rs.getString(Constants.COL_DESCRIPTION)); jobDetail.setJobClass( cascadingClassLoadHelper.loadClass(rs.getString(Constants.COL_JOB_CLASS), Job.class) ); jobDetail.setDurability(rs.getBoolean(Constants.COL_IS_DURABLE)); jobDetail.setRequestsRecovery(rs.getBoolean(Constants.COL_REQUESTS_RECOVERY)); Map<?, ?> map = (Map<?, ?>) getObjectFromBlob(rs, COL_JOB_DATAMAP); if (map != null) { jobDetail.setJobDataMap(new JobDataMap(map)); } JobId jobId = new QuartzJobId(groupName, jobName, engine.getClusterName()); QuartzJobDetail quartzJobDetail = new QuartzJobDetail(engine, jobId, jobDetail, rs.getTimestamp(WinderJDBCDelegate.COL_JOB_CREATED)); return quartzJobDetail; }
private boolean isRunningElsewhere(final JobKey jobKey) throws SchedulerException { if (!scheduler.getScheduler().getMetaData().isJobStoreClustered()) { return false; } DataSource dataSource = domainsHolder.getDomains().get(SyncopeConstants.MASTER_DOMAIN); Connection conn = DataSourceUtils.getConnection(dataSource); PreparedStatement stmt = null; ResultSet resultSet = null; try { stmt = conn.prepareStatement( "SELECT 1 FROM " + Constants.DEFAULT_TABLE_PREFIX + "FIRED_TRIGGERS " + "WHERE JOB_NAME = ? AND JOB_GROUP = ?"); stmt.setString(1, jobKey.getName()); stmt.setString(2, jobKey.getGroup()); resultSet = stmt.executeQuery(); return resultSet.next(); } catch (SQLException e) { throw new SchedulerException(e); } finally { IOUtil.quietClose(resultSet); IOUtil.quietClose(stmt); DataSourceUtils.releaseConnection(conn, dataSource); } }
@Override public void pauseTrigger(TriggerKey triggerKey) throws JobPersistenceException { triggerStore.updateTriggerState(triggerKey, Constants.STATE_WAITING); }