本文整理汇总了Java中org.quartz.impl.JobDetailImpl.setKey方法的典型用法代码示例。如果您正苦于以下问题:Java JobDetailImpl.setKey方法的具体用法?Java JobDetailImpl.setKey怎么用?Java JobDetailImpl.setKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.quartz.impl.JobDetailImpl
的用法示例。
在下文中一共展示了JobDetailImpl.setKey方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: 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;
}
示例4: initJobDetail
import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
private JobDetailImpl initJobDetail(String currentInstanceName){
String clusterJobInstanceNames[]=instanceNames.split(",");
SessionFactory sessionFactory=EnvironmentUtils.getEnvironment().getSessionFactory();
JobDetailImpl jobDetail=new DetectionJobDetail(sessionFactory,currentInstanceName,clusterJobInstanceNames,schedulerService);
jobDetail.setKey(new JobKey("UfloDaemonJobDetail"));
jobDetail.setName("UfloDaemonDetectionJobDetail");
return jobDetail;
}
示例5: jobDetailMyJobOne
import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
private static JobDetail jobDetailMyJobOne() {
JobDetailImpl jobDetail = new JobDetailImpl();
jobDetail.setKey(new JobKey("jobone", "mygroup"));
jobDetail.setJobClass(MyJobOne.class);
// remain stored in the job store even if no triggers point to it anymore
jobDetail.setDurability(true);
return jobDetail;
}
示例6: 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;
}
示例7: job
import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
private static JobDetail job(final Method method) {
JobDetailImpl detail = new MethodJobDetail(method);
detail.setJobClass(ReflectiveJob.class);
detail.setKey(jobKey(method));
return detail;
}
示例8: schedule
import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
private void schedule(NamedJob job, long delay, long period) throws SchedulerException {
JobDetailImpl jobDetail = new JobDetailImpl();
jobDetail.setKey(new JobKey(job.getName()));
jobDetail.setJobClass(job.getClass());
this.quartzFactory.register(job.getName(), job, period == 0 ? false : true);
TriggerBuilder<Trigger> builder = TriggerBuilder.newTrigger()
.withIdentity(jobDetail.getKey().getName().concat("_trigger"));
if (delay != 0) {
Date delayDate = new Date();
delayDate = new Date(delayDate.getTime() + delay);
builder = builder.startAt(delayDate);
}
else {
builder = builder.startNow();
}
if (period != 0) {
builder.withSchedule(
SimpleScheduleBuilder.simpleSchedule()
.withIntervalInMilliseconds(period)
.repeatForever());
}
Trigger trigger = builder.build();
try {
this.quartz.scheduleJob(jobDetail, trigger);
LOGGER.info(
String.format("Added Job '%s' (%s) to scheduling. Next execution at %s; Recurring: %s",
jobDetail.getKey().getName(),
job.getClass().getSimpleName(),
trigger.getStartTime(),
period));
} catch (SchedulerException e) {
LOGGER.warn(e.getMessage(), e);
throw e;
}
}
示例9: submit
import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
@Override
public void submit(String identifier, CheckRunner t, long delay, long period)
throws TaskExecutorException {
QuartzRunner job = new QuartzRunner(t, this.db);
JobDetailImpl jobDetail = new JobDetailImpl();
jobDetail.setKey(new JobKey(identifier));
jobDetail.setJobClass(job.getClass());
this.factory.register(jobDetail.getKey().getName(), job);
TriggerBuilder<Trigger> builder = TriggerBuilder.newTrigger()
.withIdentity(identifier.concat("_trigger"));
if (delay != 0) {
Date delayDate = new Date();
delayDate = new Date(delayDate.getTime() + delay);
builder = builder.startAt(delayDate);
}
else {
builder = builder.startNow();
}
if (period != 0) {
builder.withSchedule(
SimpleScheduleBuilder.simpleSchedule()
.withIntervalInMilliseconds(period)
.repeatForever());
}
Trigger trigger = builder.build();
try {
this.quartz.scheduleJob(jobDetail, trigger);
synchronized (this) {
this.jobs.put(identifier, jobDetail);
}
logger.info("Added Job '{}' to scheduling.", identifier);
} catch (SchedulerException e) {
logger.warn(e.getMessage(), e);
throw new TaskExecutorException(e);
}
}