當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。