本文整理汇总了Java中org.quartz.JobDetail.setName方法的典型用法代码示例。如果您正苦于以下问题:Java JobDetail.setName方法的具体用法?Java JobDetail.setName怎么用?Java JobDetail.setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.quartz.JobDetail
的用法示例。
在下文中一共展示了JobDetail.setName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newJobDetail
import org.quartz.JobDetail; //导入方法依赖的package包/类
/**
* @param cData
* @return JobDetail
*/
public static JobDetail newJobDetail(CompositeData cData) {
JobDetail jobDetail = new JobDetail();
int i = 0;
jobDetail.setName((String) cData.get(ITEM_NAMES[i++]));
jobDetail.setGroup((String) cData.get(ITEM_NAMES[i++]));
jobDetail.setDescription((String) cData.get(ITEM_NAMES[i++]));
try {
Class c = Class.forName((String) cData.get(ITEM_NAMES[i++]));
jobDetail.setJobClass(c);
} catch (ClassNotFoundException cnfe) {
/**/
}
jobDetail.setJobDataMap(JobDataMapSupport
.newJobDataMap((TabularData) cData.get(ITEM_NAMES[i++])));
jobDetail.setVolatility((Boolean) cData.get(ITEM_NAMES[i++]));
jobDetail.setDurability((Boolean) cData.get(ITEM_NAMES[i++]));
jobDetail.setRequestsRecovery((Boolean) cData.get(ITEM_NAMES[i++]));
return jobDetail;
}
示例2: getJobDetail
import org.quartz.JobDetail; //导入方法依赖的package包/类
/**
* Get the job detail.
*
* @return - the job detail.
*/
private JobDetail getJobDetail()
{
JobDataMap jobDataMap = new JobDataMap();
jobDataMap.put(ACTION_JOB_DATA_MAP_KEY, this);
JobDetail jobDetail = new JobDetail();
jobDetail.setName(getJobName());
jobDetail.setGroup(getJobGroup());
jobDetail.setJobDataMap(jobDataMap);
jobDetail.setJobClass(JobDefinition.class);
return jobDetail;
}
示例3: selectJobForTrigger
import org.quartz.JobDetail; //导入方法依赖的package包/类
/**
* <p>
* Select the job to which the trigger is associated.
* </p>
*
* @param conn
* the DB Connection
* @param triggerName
* the name of the trigger
* @param groupName
* the group containing the trigger
* @return the <code>{@link org.quartz.JobDetail}</code> object
* associated with the given trigger
* @throws SQLException
* @throws ClassNotFoundException
*/
public JobDetail selectJobForTrigger(Connection conn, String triggerName,
String groupName, ClassLoadHelper loadHelper) throws ClassNotFoundException, SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement(rtp(SELECT_JOB_FOR_TRIGGER));
ps.setString(1, triggerName);
ps.setString(2, groupName);
rs = ps.executeQuery();
if (rs.next()) {
JobDetail job = new JobDetail();
job.setName(rs.getString(1));
job.setGroup(rs.getString(2));
job.setDurability(getBoolean(rs, 3));
job.setJobClass(loadHelper.loadClass(rs
.getString(4)));
job.setRequestsRecovery(getBoolean(rs, 5));
return job;
} else {
if (logger.isDebugEnabled()) {
logger.debug("No job for trigger '" + groupName + "."
+ triggerName + "'.");
}
return null;
}
} finally {
closeResultSet(rs);
closeStatement(ps);
}
}
示例4: scheduleJobs
import org.quartz.JobDetail; //导入方法依赖的package包/类
private void scheduleJobs() throws ParseException, SchedulerException {
if (log.isDebugEnabled()) log.debug("Creating jobs for buildID: " + activeBuildID);
if (buildRunner == null) throw new SchedulerException("Build runner for scheduler is undefined");
if (!triggerKeyList.isEmpty()) throw new SchedulerException("Jobs should be unscheduled before scheduling jobs.");
// create schedule triggers for this build
if (log.isDebugEnabled()) log.debug("Creating schedule triggers for buildID: " + activeBuildID);
int nameIndex = 0;
final List itemList = ConfigurationManager.getInstance().getScheduleItems(activeBuildID);
for (final Iterator iter = itemList.iterator(); iter.hasNext();) {
// create trigger
final ScheduleItem scheduleItem = (ScheduleItem) iter.next();
final CronTrigger[] triggers = makeCronTriggers(activeBuildID, scheduleItem);
// go through the list of triggers
for (int i = 0; i < triggers.length; i++) {
final CronTrigger trigger = triggers[i];
trigger.setName(makeTriggerName(nameIndex));
final TriggerKey key = new TriggerKey(trigger.getName(), trigger.getGroup());
triggerKeyList.add(key);
// make job detail
final JobDetail jobDetail = makeJobDetail(activeBuildID, RepeatableScheduleJob.class);
jobDetail.setName(makeJobName(nameIndex));
// set build parameters
final JobDataMap dataMap = new JobDataMap();
dataMap.put(RepeatableScheduleJob.BUILD_ID_KEY, activeBuildID);
dataMap.put(RepeatableScheduleJob.BUILD_RUNNER_KEY, buildRunner);
dataMap.put(RepeatableScheduleJob.CLEAN_CHECKOUT_COUNTER, cleanCheckoutCounter);
dataMap.put(RepeatableScheduleJob.FORCE_CLEAN_CHECKOUT, Boolean.valueOf(scheduleItem.isCleanCheckout()));
dataMap.put(RepeatableScheduleJob.RUN_IF_NO_CHANGES, Boolean.valueOf(scheduleItem.isRunIfNoChanges()));
jobDetail.setJobDataMap(dataMap);
// schedule
if (log.isDebugEnabled()) log.debug("Scheduling job for buildID: " + activeBuildID);
scheduler.scheduleJob(jobDetail, trigger);
nameIndex++;
}
}
}