当前位置: 首页>>代码示例>>Java>>正文


Java JobDetailImpl.setKey方法代码示例

本文整理汇总了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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:JobBuilder.java

示例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;
}
 
开发者ID:jlinn,项目名称:quartz-redis-jobstore,代码行数:30,代码来源:AbstractRedisStorage.java

示例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;
}
 
开发者ID:quqiangsheng,项目名称:abhot,代码行数:14,代码来源:RollUpManager.java

示例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;
}
 
开发者ID:youseries,项目名称:uflo,代码行数:9,代码来源:InstanceDetection.java

示例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;
}
 
开发者ID:nikos,项目名称:springboot-quartz-mongodb,代码行数:9,代码来源:JobConfiguration.java

示例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;
}
 
开发者ID:nikos,项目名称:springboot-quartz-mongodb,代码行数:12,代码来源:JobConfiguration.java

示例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;
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:7,代码来源:JobExpander.java

示例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;
	}
}
 
开发者ID:52North,项目名称:ArcGIS-Server-SOS-Extension,代码行数:42,代码来源:QuartzCacheScheduler.java

示例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);
	}

}
 
开发者ID:52North,项目名称:Supervisor,代码行数:46,代码来源:QuartzTaskExecutor.java


注:本文中的org.quartz.impl.JobDetailImpl.setKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。