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


Java JobDetailImpl.setDurability方法代码示例

本文整理汇总了Java中org.quartz.impl.JobDetailImpl.setDurability方法的典型用法代码示例。如果您正苦于以下问题:Java JobDetailImpl.setDurability方法的具体用法?Java JobDetailImpl.setDurability怎么用?Java JobDetailImpl.setDurability使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.quartz.impl.JobDetailImpl的用法示例。


在下文中一共展示了JobDetailImpl.setDurability方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: afterPropertiesSet

import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void afterPropertiesSet() throws ClassNotFoundException, NoSuchMethodException {
	prepare();

	// Use specific name if given, else fall back to bean name.
	String name = (this.name != null ? this.name : this.beanName);

	// Consider the concurrent flag to choose between stateful and stateless job.
	Class<?> jobClass = (this.concurrent ? MethodInvokingJob.class : StatefulMethodInvokingJob.class);

	// Build JobDetail instance.
	JobDetailImpl jdi = new JobDetailImpl();
	jdi.setName(name);
	jdi.setGroup(this.group);
	jdi.setJobClass((Class) jobClass);
	jdi.setDurability(true);
	jdi.getJobDataMap().put("methodInvoker", this);
	this.jobDetail = jdi;

	postProcessJobDetail(this.jobDetail);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:23,代码来源:MethodInvokingJobDetailFactoryBean.java

示例3: 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;
}
 
开发者ID:eBay,项目名称:Winder,代码行数:27,代码来源:QuartzSchedulerManager.java

示例4: selectJobForTrigger

import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
/**
 * <p>
 * Select the job to which the trigger is associated. Allow option to load actual job class or not. When case of
 * remove, we do not need to load the class, which in many cases, it's no longer exists.
 *
 * </p>
 * 
 * @param conn
 *          the DB Connection
 * @return the <code>{@link org.quartz.JobDetail}</code> object
 *         associated with the given trigger
 * @throws SQLException
 * @throws ClassNotFoundException
 */
public JobDetail selectJobForTrigger(Connection conn, ClassLoadHelper loadHelper,
        TriggerKey triggerKey, boolean loadJobClass) throws ClassNotFoundException, SQLException {
    PreparedStatement ps = null;
    ResultSet rs = null;

    try {
        ps = conn.prepareStatement(rtp(SELECT_JOB_FOR_TRIGGER));
        ps.setString(1, triggerKey.getName());
        ps.setString(2, triggerKey.getGroup());
        rs = ps.executeQuery();

        if (rs.next()) {
            JobDetailImpl job = new JobDetailImpl();
            job.setName(rs.getString(1));
            job.setGroup(rs.getString(2));
            job.setDurability(getBoolean(rs, 3));
            if (loadJobClass)
                job.setJobClass(loadHelper.loadClass(rs.getString(4), Job.class));
            job.setRequestsRecovery(getBoolean(rs, 5));
            
            return job;
        } else {
            if (logger.isDebugEnabled()) {
                logger.debug("No job for trigger '" + triggerKey + "'.");
            }
            return null;
        }
    } finally {
        closeResultSet(rs);
        closeStatement(ps);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:47,代码来源:StdJDBCDelegate.java

示例5: 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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:JobDetailSupport.java

示例6: 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;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:29,代码来源:JobDetailFactoryBean.java

示例7: schedulerWithTaskExecutor

import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
@Test
public void schedulerWithTaskExecutor() throws Exception {
	Assume.group(TestGroup.PERFORMANCE);

	CountingTaskExecutor taskExecutor = new CountingTaskExecutor();
	DummyJob.count = 0;

	JobDetailImpl jobDetail = new JobDetailImpl();
	jobDetail.setDurability(true);
	jobDetail.setJobClass(DummyJob.class);
	jobDetail.setName("myJob");

	SimpleTriggerFactoryBean trigger = new SimpleTriggerFactoryBean();
	trigger.setName("myTrigger");
	trigger.setJobDetail(jobDetail);
	trigger.setStartDelay(1);
	trigger.setRepeatInterval(500);
	trigger.setRepeatCount(1);
	trigger.afterPropertiesSet();

	SchedulerFactoryBean bean = new SchedulerFactoryBean();
	bean.setTaskExecutor(taskExecutor);
	bean.setTriggers(trigger.getObject());
	bean.setJobDetails(jobDetail);
	bean.afterPropertiesSet();
	bean.start();

	Thread.sleep(500);
	assertTrue("DummyJob should have been executed at least once.", DummyJob.count > 0);
	assertEquals(DummyJob.count, taskExecutor.count);

	bean.destroy();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:34,代码来源:QuartzSupportTests.java

示例8: schedulerWithQuartzJobBean

import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
@Test
public void schedulerWithQuartzJobBean() throws Exception {
	Assume.group(TestGroup.PERFORMANCE);

	DummyJob.param = 0;
	DummyJob.count = 0;

	JobDetailImpl jobDetail = new JobDetailImpl();
	jobDetail.setDurability(true);
	jobDetail.setJobClass(DummyJobBean.class);
	jobDetail.setName("myJob");
	jobDetail.getJobDataMap().put("param", "10");

	SimpleTriggerFactoryBean trigger = new SimpleTriggerFactoryBean();
	trigger.setName("myTrigger");
	trigger.setJobDetail(jobDetail);
	trigger.setStartDelay(1);
	trigger.setRepeatInterval(500);
	trigger.setRepeatCount(1);
	trigger.afterPropertiesSet();

	SchedulerFactoryBean bean = new SchedulerFactoryBean();
	bean.setTriggers(trigger.getObject());
	bean.setJobDetails(jobDetail);
	bean.afterPropertiesSet();
	bean.start();

	Thread.sleep(500);
	assertEquals(10, DummyJobBean.param);
	assertTrue(DummyJobBean.count > 0);

	bean.destroy();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:34,代码来源:QuartzSupportTests.java

示例9: schedulerWithSpringBeanJobFactory

import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
@Test
public void schedulerWithSpringBeanJobFactory() throws Exception {
	Assume.group(TestGroup.PERFORMANCE);

	DummyJob.param = 0;
	DummyJob.count = 0;

	JobDetailImpl jobDetail = new JobDetailImpl();
	jobDetail.setDurability(true);
	jobDetail.setJobClass(DummyJob.class);
	jobDetail.setName("myJob");
	jobDetail.getJobDataMap().put("param", "10");
	jobDetail.getJobDataMap().put("ignoredParam", "10");

	SimpleTriggerFactoryBean trigger = new SimpleTriggerFactoryBean();
	trigger.setName("myTrigger");
	trigger.setJobDetail(jobDetail);
	trigger.setStartDelay(1);
	trigger.setRepeatInterval(500);
	trigger.setRepeatCount(1);
	trigger.afterPropertiesSet();

	SchedulerFactoryBean bean = new SchedulerFactoryBean();
	bean.setJobFactory(new SpringBeanJobFactory());
	bean.setTriggers(trigger.getObject());
	bean.setJobDetails(jobDetail);
	bean.afterPropertiesSet();
	bean.start();

	Thread.sleep(500);
	assertEquals(10, DummyJob.param);
	assertTrue("DummyJob should have been executed at least once.", DummyJob.count > 0);

	bean.destroy();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:36,代码来源:QuartzSupportTests.java

示例10: schedulerWithSpringBeanJobFactoryAndParamMismatchNotIgnored

import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
@Test
public void schedulerWithSpringBeanJobFactoryAndParamMismatchNotIgnored() throws Exception {
	Assume.group(TestGroup.PERFORMANCE);

	DummyJob.param = 0;
	DummyJob.count = 0;

	JobDetailImpl jobDetail = new JobDetailImpl();
	jobDetail.setDurability(true);
	jobDetail.setJobClass(DummyJob.class);
	jobDetail.setName("myJob");
	jobDetail.getJobDataMap().put("para", "10");
	jobDetail.getJobDataMap().put("ignoredParam", "10");

	SimpleTriggerFactoryBean trigger = new SimpleTriggerFactoryBean();
	trigger.setName("myTrigger");
	trigger.setJobDetail(jobDetail);
	trigger.setStartDelay(1);
	trigger.setRepeatInterval(500);
	trigger.setRepeatCount(1);
	trigger.afterPropertiesSet();

	SchedulerFactoryBean bean = new SchedulerFactoryBean();
	SpringBeanJobFactory jobFactory = new SpringBeanJobFactory();
	jobFactory.setIgnoredUnknownProperties("ignoredParam");
	bean.setJobFactory(jobFactory);
	bean.setTriggers(trigger.getObject());
	bean.setJobDetails(jobDetail);
	bean.afterPropertiesSet();

	Thread.sleep(500);
	assertEquals(0, DummyJob.param);
	assertTrue(DummyJob.count == 0);

	bean.destroy();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:37,代码来源:QuartzSupportTests.java

示例11: schedulerWithSpringBeanJobFactoryAndQuartzJobBean

import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
@Test
public void schedulerWithSpringBeanJobFactoryAndQuartzJobBean() throws Exception {
	Assume.group(TestGroup.PERFORMANCE);
	DummyJobBean.param = 0;
	DummyJobBean.count = 0;

	JobDetailImpl jobDetail = new JobDetailImpl();
	jobDetail.setDurability(true);
	jobDetail.setJobClass(DummyJobBean.class);
	jobDetail.setName("myJob");
	jobDetail.getJobDataMap().put("param", "10");

	SimpleTriggerFactoryBean trigger = new SimpleTriggerFactoryBean();
	trigger.setName("myTrigger");
	trigger.setJobDetail(jobDetail);
	trigger.setStartDelay(1);
	trigger.setRepeatInterval(500);
	trigger.setRepeatCount(1);
	trigger.afterPropertiesSet();

	SchedulerFactoryBean bean = new SchedulerFactoryBean();
	bean.setJobFactory(new SpringBeanJobFactory());
	bean.setTriggers(trigger.getObject());
	bean.setJobDetails(jobDetail);
	bean.afterPropertiesSet();
	bean.start();

	Thread.sleep(500);
	assertEquals(10, DummyJobBean.param);
	assertTrue(DummyJobBean.count > 0);

	bean.destroy();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:34,代码来源:QuartzSupportTests.java

示例12: 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

示例13: 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

示例14: afterPropertiesSet

import org.quartz.impl.JobDetailImpl; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void afterPropertiesSet() throws ClassNotFoundException,
		NoSuchMethodException {
	prepare();

	// Use specific name if given, else fall back to bean name.
	String name = (this.name != null ? this.name : this.beanName);

	// Consider the concurrent flag to choose between stateful and stateless
	// job.
	Class<?> jobClass = (this.concurrent ? MethodInvokingJob.class
			: StatefulMethodInvokingJob.class);

	// Build JobDetail instance.
	JobDetailImpl jdi = new JobDetailImpl();
	jdi.setName(name);
	jdi.setGroup(this.group);
	jdi.setJobClass((Class) jobClass);
	jdi.setDurability(true);
	jdi.getJobDataMap().put("methodInvoker", this);
	//jdi.getJobDataMap().put("targetJob", getTargetObject());
	this.jobDetail = jdi;

	postProcessJobDetail(this.jobDetail);
	
	TaskTriggerDefinition def = taskTriggerDefinitionCache.loadByUnique(getJobName());
	QuartzJob targetJob = (QuartzJob) getTargetObject();
	jobExecuteCounterHolder.put(targetJob.getClass(), new JobExecuteCounter(def.getMaxFireTimes(), 0));
	//targetJob.setMaxFireTimes(def.getMaxFireTimes()); //获取每个Job的最大执行次数
}
 
开发者ID:simbest,项目名称:simbest-cores,代码行数:32,代码来源:CustomMethodInvokingJobDetailFactoryBean.java

示例15: 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;
}
 
开发者ID:quickbundle,项目名称:qb-archetype,代码行数:13,代码来源:JobDetailVo.java


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