项目:Winder
文件:QuartzSchedulerManager.java
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);
}
}
项目:quartz-couchdb-store
文件:CouchDbStore.java
@Override
public void pauseTrigger(TriggerKey triggerKey) throws JobPersistenceException {
triggerStore.updateTriggerState(triggerKey,Constants.STATE_WAITING);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。