本文整理汇总了Java中org.quartz.impl.JobDetailImpl.setJobDataMap方法的典型用法代码示例。如果您正苦于以下问题:Java JobDetailImpl.setJobDataMap方法的具体用法?Java JobDetailImpl.setJobDataMap怎么用?Java JobDetailImpl.setJobDataMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.quartz.impl.JobDetailImpl
的用法示例。
在下文中一共展示了JobDetailImpl.setJobDataMap方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
/**
* Produce the <code>JobDetail</code> instance defined by this
* <code>JobBuilder</code>.
*
* @return the defined JobDetail.
*/
public JobDetail build() {
JobDetailImpl job = new JobDetailImpl();
job.setJobClass(jobClass);
job.setDescription(description);
if(key == null)
key = new JobKey(Key.createUniqueName(null), null);
job.setKey(key);
job.setDurability(durability);
job.setRequestsRecovery(shouldRecover);
if(!jobDataMap.isEmpty())
job.setJobDataMap(jobDataMap);
return job;
}
示例2: makeJobDetail
import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
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;
}
示例3: retrieveJob
import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
/**
* Retrieve a job from redis
* @param jobKey the job key detailing the identity of the job to be retrieved
* @param jedis a thread-safe Redis connection
* @return the {@link org.quartz.JobDetail} of the desired job
* @throws JobPersistenceException if the desired job does not exist
* @throws ClassNotFoundException
*/
public JobDetail retrieveJob(JobKey jobKey, T jedis) throws JobPersistenceException, ClassNotFoundException{
final String jobHashKey = redisSchema.jobHashKey(jobKey);
final String jobDataMapHashKey = redisSchema.jobDataMapHashKey(jobKey);
final Map<String, String> jobDetailMap = jedis.hgetAll(jobHashKey);
if(jobDetailMap == null || jobDetailMap.size() == 0){
// desired job does not exist
return null;
}
JobDetailImpl jobDetail = mapper.convertValue(jobDetailMap, JobDetailImpl.class);
jobDetail.setKey(jobKey);
final Map<String, String> jobData = jedis.hgetAll(jobDataMapHashKey);
if(jobData != null && !jobData.isEmpty()){
JobDataMap jobDataMap = new JobDataMap();
jobDataMap.putAll(jobData);
jobDetail.setJobDataMap(jobDataMap);
}
return jobDetail;
}
示例4: scheduleMessage
import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
protected void scheduleMessage(PersistedMessageBO message) throws SchedulerException {
LOG.debug("Scheduling execution of a delayed asynchronous message.");
Scheduler scheduler = KSBServiceLocator.getScheduler();
JobDataMap jobData = new JobDataMap();
jobData.put(MessageServiceExecutorJob.MESSAGE_KEY, message);
JobDetailImpl jobDetail = new JobDetailImpl("Delayed_Asynchronous_Call-" + Math.random(), "Delayed_Asynchronous_Call",
MessageServiceExecutorJob.class);
jobDetail.setJobDataMap(jobData);
scheduler.getListenerManager().addJobListener( new MessageServiceExecutorJobListener());
SimpleTriggerImpl trigger = new SimpleTriggerImpl("Delayed_Asynchronous_Call_Trigger-" + Math.random(),
"Delayed_Asynchronous_Call", message.getQueueDate());
trigger.setJobDataMap(jobData);// 1.6 bug required or derby will choke
scheduler.scheduleJob(jobDetail, trigger);
}
示例5: scheduleExecution
import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
public void scheduleExecution(Throwable throwable, PersistedMessageBO message, String description) throws Exception {
KSBServiceLocator.getMessageQueueService().delete(message);
PersistedMessageBO messageCopy = message.copy();
Scheduler scheduler = KSBServiceLocator.getScheduler();
JobDataMap jobData = new JobDataMap();
jobData.put(MessageServiceExecutorJob.MESSAGE_KEY, messageCopy);
JobDetailImpl jobDetail = new JobDetailImpl("Exception_Message_Job " + Math.random(), "Exception Messaging",
MessageServiceExecutorJob.class);
jobDetail.setJobDataMap(jobData);
if (!StringUtils.isBlank(description)) {
jobDetail.setDescription(description);
}
scheduler.getListenerManager().addJobListener( new MessageServiceExecutorJobListener());
SimpleTriggerImpl trigger = new SimpleTriggerImpl("Exception_Message_Trigger " + Math.random(), "Exception Messaging", messageCopy
.getQueueDate());
trigger.setJobDataMap(jobData);// 1.6 bug required or derby will choke
scheduler.scheduleJob(jobDetail, trigger);
}
示例6: testSchedulingJob
import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
@Test
public void testSchedulingJob() throws Exception {
Scheduler scheduler = KSBServiceLocator.getScheduler();
JobDataMap datMap = new JobDataMap();
datMap.put("yo", "yo");
JobDetailImpl jobDetail = new JobDetailImpl("myJob", null, TestJob.class);
jobDetail.setJobDataMap(datMap);
TriggerBuilder triggerBuilder = TriggerBuilder.newTrigger();
triggerBuilder.startAt(new Date());
triggerBuilder.withIdentity("i'm a trigger puller");
triggerBuilder.usingJobData(datMap);
triggerBuilder.withSchedule(SimpleScheduleBuilder.simpleSchedule().withRepeatCount(1).withIntervalInMilliseconds(1L));
Trigger trigger = triggerBuilder.build();
scheduler.scheduleJob(jobDetail, trigger);
synchronized (TestJob.LOCK) {
TestJob.LOCK.wait(30 * 1000);
}
assertTrue("job never fired", TestJob.EXECUTED);
}
示例7: newJobDetail
import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
/**
* @param cData
* @return JobDetail
*/
public static JobDetail newJobDetail(CompositeData cData)
throws ClassNotFoundException
{
JobDetailImpl jobDetail = new JobDetailImpl();
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++]));
Class<?> jobClass = Class.forName((String) cData.get(ITEM_NAMES[i++]));
@SuppressWarnings("unchecked")
Class<? extends Job> jobClassTyped = (Class<? extends Job>)jobClass;
jobDetail.setJobClass(jobClassTyped);
jobDetail.setJobDataMap(JobDataMapSupport.newJobDataMap((TabularData) cData.get(ITEM_NAMES[i++])));
jobDetail.setDurability((Boolean) cData.get(ITEM_NAMES[i++]));
jobDetail.setRequestsRecovery((Boolean) cData.get(ITEM_NAMES[i++]));
return jobDetail;
}
示例8: createJobDetail
import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
static JobDetailImpl createJobDetail(RollupTask task, KairosDatastore dataStore, String hostName)
{
JobDetailImpl jobDetail = new JobDetailImpl();
jobDetail.setJobClass(RollUpJob.class);
jobDetail.setKey(getJobKey(task));
JobDataMap map = new JobDataMap();
map.put("task", task);
map.put("datastore", dataStore);
map.put("hostName", hostName);
jobDetail.setJobDataMap(map);
return jobDetail;
}
示例9: afterPropertiesSet
import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void afterPropertiesSet() {
if (this.name == null) {
this.name = this.beanName;
}
if (this.group == null) {
this.group = Scheduler.DEFAULT_GROUP;
}
if (this.applicationContextJobDataKey != null) {
if (this.applicationContext == null) {
throw new IllegalStateException(
"JobDetailBean needs to be set up in an ApplicationContext " +
"to be able to handle an 'applicationContextJobDataKey'");
}
getJobDataMap().put(this.applicationContextJobDataKey, this.applicationContext);
}
JobDetailImpl jdi = new JobDetailImpl();
jdi.setName(this.name);
jdi.setGroup(this.group);
jdi.setJobClass((Class) this.jobClass);
jdi.setJobDataMap(this.jobDataMap);
jdi.setDurability(this.durability);
jdi.setRequestsRecovery(this.requestsRecovery);
jdi.setDescription(this.description);
this.jobDetail = jdi;
}
示例10: jobDetailMyJobTwo
import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
private static JobDetail jobDetailMyJobTwo() {
JobDetailImpl jobDetail = new JobDetailImpl();
jobDetail.setKey(new JobKey("jobtwo", "mygroup"));
jobDetail.setJobClass(MyJobTwo.class);
jobDetail.setDurability(true);
JobDataMap map = new JobDataMap();
map.put("name", "HaHa");
map.put(MyJobTwo.COUNT, 1);
jobDetail.setJobDataMap(map);
return jobDetail;
}
示例11: getJobDetail
import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
/**
* get JobDetail
* @param jobParamer
* @return
*/
private JobDetail getJobDetail(JobParamer jobParamer){
JobDetailImpl jobDetail = new JobDetailImpl();// 任务名,任务组,任务执行类
jobDetail.setGroup(jobParamer.getGroupName());
jobDetail.setName(jobParamer.getId());
jobDetail.setJobClass(CommonJob.class);
JobDataMap jobDataMap = new JobDataMap();
jobDataMap.put("jobParamer", jobParamer);
jobDetail.setJobDataMap(jobDataMap);
return jobDetail;
}
示例12: toQuartzJobDetail
import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
public JobDetail toQuartzJobDetail() throws ClassNotFoundException {
JobDetailImpl jd = new JobDetailImpl();
jd.setDescription(description);
jd.setDurability("1".equals(is_durable));
jd.setName(job_name);
jd.setGroup("".equals(job_group) ? null : job_group);
Class cls = Class.forName(job_class_name);
jd.setJobClass(cls);
jd.setRequestsRecovery("1".equals(requests_recovery));
jd.setJobDataMap(dataMap);
return jd;
}