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


Java SimpleTrigger.setJobName方法代码示例

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


在下文中一共展示了SimpleTrigger.setJobName方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildIndexHtml

import org.quartz.SimpleTrigger; //导入方法依赖的package包/类
public void buildIndexHtml() {
	try {
		SimpleTrigger simpleTrigger = new SimpleTrigger();
		simpleTrigger.setName(BuildIndexHtmlJob.TRIGGER_NAME);
		simpleTrigger.setGroup(BuildIndexHtmlJob.GROUP_NAME);
		simpleTrigger.setJobName(BuildIndexHtmlJob.JOB_NAME);
		simpleTrigger.setJobGroup(BuildIndexHtmlJob.GROUP_NAME);
		simpleTrigger.setStartTime(DateUtils.addSeconds(new Date(), SettingUtil.getSetting().getBuildHtmlDelayTime()));
		simpleTrigger.setRepeatCount(0);
		simpleTrigger.setRepeatInterval(60);
		
		JobDetail jobDetail = scheduler.getJobDetail(BuildIndexHtmlJob.JOB_NAME, BuildIndexHtmlJob.GROUP_NAME);
		if (jobDetail != null) {
			scheduler.rescheduleJob(BuildIndexHtmlJob.TRIGGER_NAME, BuildIndexHtmlJob.GROUP_NAME, simpleTrigger);
		} else {
			jobDetail = new JobDetail(BuildIndexHtmlJob.JOB_NAME, BuildIndexHtmlJob.GROUP_NAME, BuildIndexHtmlJob.class);
			scheduler.scheduleJob(jobDetail, simpleTrigger);
		}
		
		if (scheduler.isShutdown()) {
			scheduler.start();
		}
	} catch (SchedulerException e) {
		e.printStackTrace();
	}
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:27,代码来源:JobServiceImpl.java

示例2: buildLoginHtml

import org.quartz.SimpleTrigger; //导入方法依赖的package包/类
public void buildLoginHtml() {
	try {
		SimpleTrigger simpleTrigger = new SimpleTrigger();
		simpleTrigger.setName(BuildLoginHtmlJob.TRIGGER_NAME);
		simpleTrigger.setGroup(BuildLoginHtmlJob.GROUP_NAME);
		simpleTrigger.setJobName(BuildLoginHtmlJob.JOB_NAME);
		simpleTrigger.setJobGroup(BuildLoginHtmlJob.GROUP_NAME);
		simpleTrigger.setStartTime(DateUtils.addSeconds(new Date(), SettingUtil.getSetting().getBuildHtmlDelayTime()));
		simpleTrigger.setRepeatCount(0);
		simpleTrigger.setRepeatInterval(60);
		
		JobDetail jobDetail = scheduler.getJobDetail(BuildLoginHtmlJob.JOB_NAME, BuildLoginHtmlJob.GROUP_NAME);
		if (jobDetail != null) {
			scheduler.rescheduleJob(BuildLoginHtmlJob.TRIGGER_NAME, BuildLoginHtmlJob.GROUP_NAME, simpleTrigger);
		} else {
			jobDetail = new JobDetail(BuildLoginHtmlJob.JOB_NAME, BuildLoginHtmlJob.GROUP_NAME, BuildLoginHtmlJob.class);
			scheduler.scheduleJob(jobDetail, simpleTrigger);
		}
		
		if (scheduler.isShutdown()) {
			scheduler.start();
		}
	} catch (SchedulerException e) {
		e.printStackTrace();
	}
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:27,代码来源:JobServiceImpl.java

示例3: buildRegisterAgreementHtml

import org.quartz.SimpleTrigger; //导入方法依赖的package包/类
public void buildRegisterAgreementHtml() {
	try {
		SimpleTrigger simpleTrigger = new SimpleTrigger();
		simpleTrigger.setName(BuildRegisterAgreementHtmlJob.TRIGGER_NAME);
		simpleTrigger.setGroup(BuildRegisterAgreementHtmlJob.GROUP_NAME);
		simpleTrigger.setJobName(BuildRegisterAgreementHtmlJob.JOB_NAME);
		simpleTrigger.setJobGroup(BuildRegisterAgreementHtmlJob.GROUP_NAME);
		simpleTrigger.setStartTime(DateUtils.addSeconds(new Date(), SettingUtil.getSetting().getBuildHtmlDelayTime()));
		simpleTrigger.setRepeatCount(0);
		simpleTrigger.setRepeatInterval(60);
		
		JobDetail jobDetail = scheduler.getJobDetail(BuildRegisterAgreementHtmlJob.JOB_NAME, BuildRegisterAgreementHtmlJob.GROUP_NAME);
		if (jobDetail != null) {
			scheduler.rescheduleJob(BuildRegisterAgreementHtmlJob.TRIGGER_NAME, BuildRegisterAgreementHtmlJob.GROUP_NAME, simpleTrigger);
		} else {
			jobDetail = new JobDetail(BuildRegisterAgreementHtmlJob.JOB_NAME, BuildRegisterAgreementHtmlJob.GROUP_NAME, BuildRegisterAgreementHtmlJob.class);
			scheduler.scheduleJob(jobDetail, simpleTrigger);
		}
		
		if (scheduler.isShutdown()) {
			scheduler.start();
		}
	} catch (SchedulerException e) {
		e.printStackTrace();
	}
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:27,代码来源:JobServiceImpl.java

示例4: buildAdminJs

import org.quartz.SimpleTrigger; //导入方法依赖的package包/类
public void buildAdminJs() {
	try {
		SimpleTrigger simpleTrigger = new SimpleTrigger();
		simpleTrigger.setName(BuildAdminJsJob.TRIGGER_NAME);
		simpleTrigger.setGroup(BuildAdminJsJob.GROUP_NAME);
		simpleTrigger.setJobName(BuildAdminJsJob.JOB_NAME);
		simpleTrigger.setJobGroup(BuildAdminJsJob.GROUP_NAME);
		simpleTrigger.setStartTime(DateUtils.addSeconds(new Date(), SettingUtil.getSetting().getBuildHtmlDelayTime()));
		simpleTrigger.setRepeatCount(0);
		simpleTrigger.setRepeatInterval(60);
		
		JobDetail jobDetail = scheduler.getJobDetail(BuildAdminJsJob.JOB_NAME, BuildAdminJsJob.GROUP_NAME);
		if (jobDetail != null) {
			scheduler.rescheduleJob(BuildAdminJsJob.TRIGGER_NAME, BuildAdminJsJob.GROUP_NAME, simpleTrigger);
		} else {
			jobDetail = new JobDetail(BuildAdminJsJob.JOB_NAME, BuildAdminJsJob.GROUP_NAME, BuildAdminJsJob.class);
			scheduler.scheduleJob(jobDetail, simpleTrigger);
		}
		
		if (scheduler.isShutdown()) {
			scheduler.start();
		}
	} catch (SchedulerException e) {
		e.printStackTrace();
	}
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:27,代码来源:JobServiceImpl.java

示例5: buildShopJs

import org.quartz.SimpleTrigger; //导入方法依赖的package包/类
public void buildShopJs() {
	try {
		SimpleTrigger simpleTrigger = new SimpleTrigger();
		simpleTrigger.setName(BuildShopJsJob.TRIGGER_NAME);
		simpleTrigger.setGroup(BuildShopJsJob.GROUP_NAME);
		simpleTrigger.setJobName(BuildShopJsJob.JOB_NAME);
		simpleTrigger.setJobGroup(BuildShopJsJob.GROUP_NAME);
		simpleTrigger.setStartTime(DateUtils.addSeconds(new Date(), SettingUtil.getSetting().getBuildHtmlDelayTime()));
		simpleTrigger.setRepeatCount(0);
		simpleTrigger.setRepeatInterval(60);
		
		JobDetail jobDetail = scheduler.getJobDetail(BuildShopJsJob.JOB_NAME, BuildShopJsJob.GROUP_NAME);
		if (jobDetail != null) {
			scheduler.rescheduleJob(BuildShopJsJob.TRIGGER_NAME, BuildShopJsJob.GROUP_NAME, simpleTrigger);
		} else {
			jobDetail = new JobDetail(BuildShopJsJob.JOB_NAME, BuildShopJsJob.GROUP_NAME, BuildShopJsJob.class);
			scheduler.scheduleJob(jobDetail, simpleTrigger);
		}
		
		if (scheduler.isShutdown()) {
			scheduler.start();
		}
	} catch (SchedulerException e) {
		e.printStackTrace();
	}
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:27,代码来源:JobServiceImpl.java

示例6: buildErrorHtml

import org.quartz.SimpleTrigger; //导入方法依赖的package包/类
public void buildErrorHtml() {
	try {
		SimpleTrigger simpleTrigger = new SimpleTrigger();
		simpleTrigger.setName(BuildErrorHtmlJob.TRIGGER_NAME);
		simpleTrigger.setGroup(BuildErrorHtmlJob.GROUP_NAME);
		simpleTrigger.setJobName(BuildErrorHtmlJob.JOB_NAME);
		simpleTrigger.setJobGroup(BuildErrorHtmlJob.GROUP_NAME);
		simpleTrigger.setStartTime(DateUtils.addSeconds(new Date(), SettingUtil.getSetting().getBuildHtmlDelayTime()));
		simpleTrigger.setRepeatCount(0);
		simpleTrigger.setRepeatInterval(60);
		
		JobDetail jobDetail = scheduler.getJobDetail(BuildErrorHtmlJob.JOB_NAME, BuildErrorHtmlJob.GROUP_NAME);
		if (jobDetail != null) {
			scheduler.rescheduleJob(BuildErrorHtmlJob.TRIGGER_NAME, BuildErrorHtmlJob.GROUP_NAME, simpleTrigger);
		} else {
			jobDetail = new JobDetail(BuildErrorHtmlJob.JOB_NAME, BuildErrorHtmlJob.GROUP_NAME, BuildErrorHtmlJob.class);
			scheduler.scheduleJob(jobDetail, simpleTrigger);
		}
		
		if (scheduler.isShutdown()) {
			scheduler.start();
		}
	} catch (SchedulerException e) {
		e.printStackTrace();
	}
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:27,代码来源:JobServiceImpl.java

示例7: scheduleJob

import org.quartz.SimpleTrigger; //导入方法依赖的package包/类
private void scheduleJob() {
    LOG.debug("Queueing processing job");
    try {
        Scheduler scheduler = KSBServiceLocator.getScheduler();
        if (synchronous) {
            LOG.debug("Invoking job synchronously in Thread " + Thread.currentThread());
            MessageProcessingJob job = new MessageProcessingJob(messageId, mode, user, cause);
            job.run();
        } else {
            String uniqueTriggerName = jobName + "-Trigger-" + System.currentTimeMillis() + Math.random();
            SimpleTrigger trigger = new SimpleTrigger(uniqueTriggerName, jobGroup + "-Trigger");
            LOG.debug("Scheduling trigger: " + trigger);

            JobDataMap data = new JobDataMap();
            data.put("mode", mode.name());
            data.put("user", user);
            data.put("cause", cause);
            data.put("messageId", messageId);

            trigger.setJobName(jobName);
            trigger.setJobGroup(jobGroup);
            trigger.setJobDataMap(data);
            scheduler.scheduleJob(trigger);
        }
    } catch (SchedulerException se) {
        throw new RuntimeException(se);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:MessagingServiceImpl.java

示例8: buildArticleContentHtml

import org.quartz.SimpleTrigger; //导入方法依赖的package包/类
public void buildArticleContentHtml(String id) {
	try {
		String jobName = BuildArticleContentHtmlJob.JOB_NAME + id;
		String triggerName = BuildArticleContentHtmlJob.TRIGGER_NAME + id;
		String groupName = BuildArticleContentHtmlJob.GROUP_NAME;
		
		SimpleTrigger simpleTrigger = new SimpleTrigger();
		simpleTrigger.setName(triggerName);
		simpleTrigger.setGroup(groupName);
		simpleTrigger.setJobName(jobName);
		simpleTrigger.setJobGroup(groupName);
		simpleTrigger.setStartTime(DateUtils.addSeconds(new Date(), SettingUtil.getSetting().getBuildHtmlDelayTime()));
		simpleTrigger.setRepeatCount(0);
		simpleTrigger.setRepeatInterval(60);
		
		JobDetail jobDetail = scheduler.getJobDetail(jobName, groupName);
		if (jobDetail != null) {
			scheduler.rescheduleJob(triggerName, groupName, simpleTrigger);
			jobDetail.getJobDataMap().put("id", id);
		} else {
			jobDetail = new JobDetail(jobName, groupName, BuildArticleContentHtmlJob.class);
			jobDetail.getJobDataMap().put("id", id);
			scheduler.scheduleJob(jobDetail, simpleTrigger);
		}
		
		if (scheduler.isShutdown()) {
			scheduler.start();
		}
	} catch (SchedulerException e) {
		e.printStackTrace();
	}
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:33,代码来源:JobServiceImpl.java

示例9: buildGoodsContentHtml

import org.quartz.SimpleTrigger; //导入方法依赖的package包/类
public void buildGoodsContentHtml(String id) {
	try {
		String jobName = BuildGoodsContentHtmlJob.JOB_NAME + id;
		String triggerName = BuildGoodsContentHtmlJob.TRIGGER_NAME + id;
		String groupName = BuildGoodsContentHtmlJob.GROUP_NAME;
		
		SimpleTrigger simpleTrigger = new SimpleTrigger();
		simpleTrigger.setName(triggerName);
		simpleTrigger.setGroup(groupName);
		simpleTrigger.setJobName(jobName);
		simpleTrigger.setJobGroup(groupName);
		simpleTrigger.setStartTime(DateUtils.addSeconds(new Date(), SettingUtil.getSetting().getBuildHtmlDelayTime()));
		simpleTrigger.setRepeatCount(0);
		simpleTrigger.setRepeatInterval(60);
		
		JobDetail jobDetail = scheduler.getJobDetail(jobName, groupName);
		if (jobDetail != null) {
			scheduler.rescheduleJob(triggerName, groupName, simpleTrigger);
			jobDetail.getJobDataMap().put("id", id);
		} else {
			jobDetail = new JobDetail(jobName, groupName, BuildGoodsContentHtmlJob.class);
			jobDetail.getJobDataMap().put("id", id);
			scheduler.scheduleJob(jobDetail, simpleTrigger);
		}
		
		if (scheduler.isShutdown()) {
			scheduler.start();
		}
	} catch (SchedulerException e) {
		e.printStackTrace();
	}
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:33,代码来源:JobServiceImpl.java

示例10: deleteArticleContentHtml

import org.quartz.SimpleTrigger; //导入方法依赖的package包/类
public void deleteArticleContentHtml(String htmlPath, Integer pageCount) {
	try {
		String jobName = DeleteArticleContentHtmlJob.JOB_NAME + htmlPath;
		String triggerName = DeleteArticleContentHtmlJob.TRIGGER_NAME + htmlPath;
		String groupName = DeleteArticleContentHtmlJob.GROUP_NAME;
		
		SimpleTrigger simpleTrigger = new SimpleTrigger();
		simpleTrigger.setName(triggerName);
		simpleTrigger.setGroup(groupName);
		simpleTrigger.setJobName(jobName);
		simpleTrigger.setJobGroup(groupName);
		simpleTrigger.setStartTime(DateUtils.addSeconds(new Date(), SettingUtil.getSetting().getBuildHtmlDelayTime()));
		simpleTrigger.setRepeatCount(0);
		simpleTrigger.setRepeatInterval(60);
		
		JobDetail jobDetail = scheduler.getJobDetail(jobName, groupName);
		if (jobDetail != null) {
			scheduler.rescheduleJob(triggerName, groupName, simpleTrigger);
			jobDetail.getJobDataMap().put("htmlPath", htmlPath);
			jobDetail.getJobDataMap().put("pageCount", pageCount);
		} else {
			jobDetail = new JobDetail(jobName, groupName, DeleteGoodsContentHtmlJob.class);
			jobDetail.getJobDataMap().put("htmlPath", htmlPath);
			jobDetail.getJobDataMap().put("pageCount", pageCount);
			scheduler.scheduleJob(jobDetail, simpleTrigger);
		}
		
		if (scheduler.isShutdown()) {
			scheduler.start();
		}
	} catch (SchedulerException e) {
		e.printStackTrace();
	}
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:35,代码来源:JobServiceImpl.java

示例11: deleteGoodsContentHtml

import org.quartz.SimpleTrigger; //导入方法依赖的package包/类
public void deleteGoodsContentHtml(String htmlPath) {
	try {
		String jobName = DeleteGoodsContentHtmlJob.JOB_NAME + htmlPath;
		String triggerName = DeleteGoodsContentHtmlJob.TRIGGER_NAME + htmlPath;
		String groupName = DeleteGoodsContentHtmlJob.GROUP_NAME;
		
		SimpleTrigger simpleTrigger = new SimpleTrigger();
		simpleTrigger.setName(triggerName);
		simpleTrigger.setGroup(groupName);
		simpleTrigger.setJobName(jobName);
		simpleTrigger.setJobGroup(groupName);
		simpleTrigger.setStartTime(DateUtils.addSeconds(new Date(), SettingUtil.getSetting().getBuildHtmlDelayTime()));
		simpleTrigger.setRepeatCount(0);
		simpleTrigger.setRepeatInterval(60);
		
		JobDetail jobDetail = scheduler.getJobDetail(jobName, groupName);
		if (jobDetail != null) {
			scheduler.rescheduleJob(triggerName, groupName, simpleTrigger);
			jobDetail.getJobDataMap().put("htmlPath", htmlPath);
		} else {
			jobDetail = new JobDetail(jobName, groupName, DeleteGoodsContentHtmlJob.class);
			jobDetail.getJobDataMap().put("htmlPath", htmlPath);
			scheduler.scheduleJob(jobDetail, simpleTrigger);
		}
		
		if (scheduler.isShutdown()) {
			scheduler.start();
		}
	} catch (SchedulerException e) {
		e.printStackTrace();
	}
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:33,代码来源:JobServiceImpl.java

示例12: selectTriggersForRecoveringJobs

import org.quartz.SimpleTrigger; //导入方法依赖的package包/类
/**
 * <p>
 * Select all of the triggers for jobs that are requesting recovery. The
 * returned trigger objects will have unique "recoverXXX" trigger names and
 * will be in the <code>{@link
 * org.quartz.Scheduler}.DEFAULT_RECOVERY_GROUP</code>
 * trigger group.
 * </p>
 * 
 * <p>
 * In order to preserve the ordering of the triggers, the fire time will be
 * set from the <code>COL_FIRED_TIME</code> column in the <code>TABLE_FIRED_TRIGGERS</code>
 * table. The caller is responsible for calling <code>computeFirstFireTime</code>
 * on each returned trigger. It is also up to the caller to insert the
 * returned triggers to ensure that they are fired.
 * </p>
 * 
 * @param conn
 *          the DB Connection
 * @return an array of <code>{@link org.quartz.Trigger}</code> objects
 */
public Trigger[] selectTriggersForRecoveringJobs(Connection conn)
    throws SQLException, IOException, ClassNotFoundException {
    PreparedStatement ps = null;
    ResultSet rs = null;

    try {
        ps = conn
                .prepareStatement(rtp(SELECT_INSTANCES_RECOVERABLE_FIRED_TRIGGERS));
        ps.setString(1, instanceId);
        setBoolean(ps, 2, true);
        rs = ps.executeQuery();

        long dumId = System.currentTimeMillis();
        ArrayList list = new ArrayList();
        while (rs.next()) {
            String jobName = rs.getString(COL_JOB_NAME);
            String jobGroup = rs.getString(COL_JOB_GROUP);
            String trigName = rs.getString(COL_TRIGGER_NAME);
            String trigGroup = rs.getString(COL_TRIGGER_GROUP);
            long firedTime = rs.getLong(COL_FIRED_TIME);
            int priority = rs.getInt(COL_PRIORITY);
            SimpleTrigger rcvryTrig = new SimpleTrigger("recover_"
                    + instanceId + "_" + String.valueOf(dumId++),
                    Scheduler.DEFAULT_RECOVERY_GROUP, new Date(firedTime));
            rcvryTrig.setJobName(jobName);
            rcvryTrig.setJobGroup(jobGroup);
            rcvryTrig.setPriority(priority);
            rcvryTrig
                    .setMisfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_FIRE_NOW);

            JobDataMap jd = selectTriggerJobDataMap(conn, trigName, trigGroup);
            jd.put(Scheduler.FAILED_JOB_ORIGINAL_TRIGGER_NAME, trigName);
            jd.put(Scheduler.FAILED_JOB_ORIGINAL_TRIGGER_GROUP, trigGroup);
            jd.put(Scheduler.FAILED_JOB_ORIGINAL_TRIGGER_FIRETIME_IN_MILLISECONDS, String.valueOf(firedTime));
            rcvryTrig.setJobDataMap(jd);
            
            list.add(rcvryTrig);
        }
        Object[] oArr = list.toArray();
        Trigger[] tArr = new Trigger[oArr.length];
        System.arraycopy(oArr, 0, tArr, 0, oArr.length);
        return tArr;
    } finally {
        closeResultSet(rs);
        closeStatement(ps);
    }
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:69,代码来源:StdJDBCDelegate.java

示例13: testSchedulerFactoryBeanWithPlainQuartzObjects

import org.quartz.SimpleTrigger; //导入方法依赖的package包/类
@Test
public void testSchedulerFactoryBeanWithPlainQuartzObjects() throws Exception {
	JobFactory jobFactory = new AdaptableJobFactory();

	TestBean tb = new TestBean("tb", 99);
	JobDetail jobDetail0 = new JobDetail();
	jobDetail0.setJobClass(Job.class);
	jobDetail0.setName("myJob0");
	jobDetail0.setGroup(Scheduler.DEFAULT_GROUP);
	jobDetail0.getJobDataMap().put("testBean", tb);
	assertEquals(tb, jobDetail0.getJobDataMap().get("testBean"));

	CronTrigger trigger0 = new CronTrigger();
	trigger0.setName("myTrigger0");
	trigger0.setGroup(Scheduler.DEFAULT_GROUP);
	trigger0.setJobName("myJob0");
	trigger0.setJobGroup(Scheduler.DEFAULT_GROUP);
	trigger0.setStartTime(new Date());
	trigger0.setCronExpression("0/1 * * * * ?");

	TestMethodInvokingTask task1 = new TestMethodInvokingTask();
	MethodInvokingJobDetailFactoryBean mijdfb = new MethodInvokingJobDetailFactoryBean();
	mijdfb.setName("myJob1");
	mijdfb.setGroup(Scheduler.DEFAULT_GROUP);
	mijdfb.setTargetObject(task1);
	mijdfb.setTargetMethod("doSomething");
	mijdfb.afterPropertiesSet();
	JobDetail jobDetail1 = mijdfb.getObject();

	SimpleTrigger trigger1 = new SimpleTrigger();
	trigger1.setName("myTrigger1");
	trigger1.setGroup(Scheduler.DEFAULT_GROUP);
	trigger1.setJobName("myJob1");
	trigger1.setJobGroup(Scheduler.DEFAULT_GROUP);
	trigger1.setStartTime(new Date());
	trigger1.setRepeatCount(SimpleTrigger.REPEAT_INDEFINITELY);
	trigger1.setRepeatInterval(20);

	final Scheduler scheduler = mock(Scheduler.class);
	given(scheduler.scheduleJob(trigger0)).willReturn(new Date());
	given(scheduler.scheduleJob(trigger1)).willReturn(new Date());

	SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean() {
		@Override
		protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName) {
			return scheduler;
		}
	};
	schedulerFactoryBean.setJobFactory(jobFactory);
	schedulerFactoryBean.setJobDetails(new JobDetail[] {jobDetail0, jobDetail1});
	schedulerFactoryBean.setTriggers(new Trigger[] {trigger0, trigger1});
	try {
		schedulerFactoryBean.afterPropertiesSet();
		schedulerFactoryBean.start();
	}
	finally {
		schedulerFactoryBean.destroy();
	}

	verify(scheduler).setJobFactory(jobFactory);
	verify(scheduler).getJobDetail("myJob0", Scheduler.DEFAULT_GROUP);
	verify(scheduler).getJobDetail("myJob1", Scheduler.DEFAULT_GROUP);
	verify(scheduler).getTrigger("myTrigger0", Scheduler.DEFAULT_GROUP);
	verify(scheduler).getTrigger("myTrigger1", Scheduler.DEFAULT_GROUP);
	verify(scheduler).addJob(jobDetail0, true);
	verify(scheduler).addJob(jobDetail1, true);
	verify(scheduler).scheduleJob(trigger0);
	verify(scheduler).scheduleJob(trigger1);
	verify(scheduler).start();
	verify(scheduler).shutdown(false);
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:72,代码来源:QuartzSupportTests.java

示例14: rescheduleJob

import org.quartz.SimpleTrigger; //导入方法依赖的package包/类
/**
 * Reschedule the job associated with oldTrigger
 *
 * @param oldTrigger
 *            the old trigger whose job should be rescheduled
 * @param newDate
 *            the date for rescheduling the job
 * @throws SchedulerException
 *             in case the scheduling failed
 */
private void rescheduleJob(Trigger oldTrigger, Date newDate) throws SchedulerException {
    SimpleTrigger newTrigger = new SimpleTrigger(oldTrigger.getName(), oldTrigger.getGroup(),
            newDate);
    newTrigger.setJobGroup(oldTrigger.getJobGroup());
    newTrigger.setJobName(oldTrigger.getJobName());
    jobIsRunning = false;
    getScheduler().rescheduleJob(oldTrigger.getName(), oldTrigger.getGroup(), newTrigger);
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:19,代码来源:TaskSchedulingContext.java


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