本文整理汇总了Java中org.quartz.spi.MutableTrigger类的典型用法代码示例。如果您正苦于以下问题:Java MutableTrigger类的具体用法?Java MutableTrigger怎么用?Java MutableTrigger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MutableTrigger类属于org.quartz.spi包,在下文中一共展示了MutableTrigger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import org.quartz.spi.MutableTrigger; //导入依赖的package包/类
/**
* Produce the <code>Trigger</code>.
*
* @return a Trigger that meets the specifications of the builder.
*/
@SuppressWarnings("unchecked")
public T build() {
if(scheduleBuilder == null)
scheduleBuilder = SimpleScheduleBuilder.simpleSchedule();
MutableTrigger trig = scheduleBuilder.build();
trig.setCalendarName(calendarName);
trig.setDescription(description);
trig.setStartTime(startTime);
trig.setEndTime(endTime);
if(key == null)
key = new TriggerKey(Key.createUniqueName(null), null);
trig.setKey(key);
if(jobKey != null)
trig.setJobKey(jobKey);
trig.setPriority(priority);
if(!jobDataMap.isEmpty())
trig.setJobDataMap(jobDataMap);
return (T) trig;
}
示例2: startJob
import org.quartz.spi.MutableTrigger; //导入依赖的package包/类
protected void startJob(ScheduleJobEntity jobEntity) {
try {
if(scheduler.checkExists(createJobKey(jobEntity))) {
return;
}
JobDetail jobDetail = JobBuilder
.newJob(DynamicJob.class)
.withIdentity(createJobKey(jobEntity))
.setJobData(createJobDataMap(jobEntity.getParameters()))
.usingJobData(DynamicJobFactory.JOB_ID_KEY, jobEntity.getId())
.withDescription(jobEntity.getName() + (jobEntity.getRemark() == null ? "" : jobEntity.getRemark()))
.build();
MutableTrigger trigger = scheduleTriggerBuilder.buildTrigger(jobEntity.getQuartzConfig());
trigger.setKey(createTriggerKey(jobEntity));
scheduler.scheduleJob(jobDetail, trigger);
} catch (SchedulerException e) {
throw new BusinessException("启动定时调度失败", e);
}
}
示例3: startSniffing
import org.quartz.spi.MutableTrigger; //导入依赖的package包/类
@Override
@Transactional(rollbackFor = { SchedulerException.class, ParseException.class })
public void startSniffing(final long snifferId) throws SchedulerException {
logger.debug("Starting cron job for sniffer: {}", snifferId);
final Sniffer sniffer = snifferPersistence.getSniffer(snifferId);
if (sniffer == null) {
throw new SchedulerException("Sniffer not found: " + snifferId);
}
stopAndDeleteAllSnifferJobs(sniffer.getId());
MutableTrigger trigger;
try {
trigger = CronScheduleBuilder.cronScheduleNonvalidatedExpression(sniffer.getScheduleCronExpression())
.withMisfireHandlingInstructionDoNothing().build();
} catch (final ParseException e) {
throw new SchedulerException("Failed to parse cron expression", e);
}
trigger.setKey(getKey(sniffer, sniffer.getLogSourceId()));
final JobDetail jobDetail = JobBuilder.newJob(SnifferJob.class).requestRecovery()
.withIdentity(getJobKey(sniffer, sniffer.getLogSourceId())).build();
scheduler.scheduleJob(jobDetail, trigger);
final ScheduleInfo scheduleInfo = scheduleInfoAccess.getScheduleInfo(snifferId);
scheduleInfo.setScheduled(true);
scheduleInfoAccess.updateScheduleInfo(snifferId, scheduleInfo);
logger.info("Scheduled cron job for sniffer {} and log source {} with trigger {}", sniffer,
sniffer.getLogSourceId(), trigger);
}
示例4: build
import org.quartz.spi.MutableTrigger; //导入依赖的package包/类
/**
* Build the actual Trigger -- NOT intended to be invoked by end users,
* but will rather be invoked by a TriggerBuilder which this
* ScheduleBuilder is given to.
*
* @see TriggerBuilder#withSchedule(ScheduleBuilder)
*/
@Override
public MutableTrigger build() {
SimpleTriggerImpl st = new SimpleTriggerImpl();
st.setRepeatInterval(interval);
st.setRepeatCount(repeatCount);
st.setMisfireInstruction(misfireInstruction);
return st;
}
示例5: buildTriggersByFQJobNameMap
import org.quartz.spi.MutableTrigger; //导入依赖的package包/类
private Map<JobKey, List<MutableTrigger>> buildTriggersByFQJobNameMap(List<MutableTrigger> triggers) {
Map<JobKey, List<MutableTrigger>> triggersByFQJobName = new HashMap<JobKey, List<MutableTrigger>>();
for(MutableTrigger trigger: triggers) {
List<MutableTrigger> triggersOfJob = triggersByFQJobName.get(trigger.getJobKey());
if(triggersOfJob == null) {
triggersOfJob = new LinkedList<MutableTrigger>();
triggersByFQJobName.put(trigger.getJobKey(), triggersOfJob);
}
triggersOfJob.add(trigger);
}
return triggersByFQJobName;
}
示例6: build
import org.quartz.spi.MutableTrigger; //导入依赖的package包/类
/**
* Build the actual Trigger -- NOT intended to be invoked by end users, but
* will rather be invoked by a TriggerBuilder which this ScheduleBuilder is
* given to.
*
* @see TriggerBuilder#withSchedule(ScheduleBuilder)
*/
@Override
public MutableTrigger build() {
CronTriggerImpl ct = new CronTriggerImpl();
ct.setCronExpression(cronExpression);
ct.setTimeZone(cronExpression.getTimeZone());
ct.setMisfireInstruction(misfireInstruction);
return ct;
}
示例7: build
import org.quartz.spi.MutableTrigger; //导入依赖的package包/类
/**
* Build the actual Trigger -- NOT intended to be invoked by end users,
* but will rather be invoked by a TriggerBuilder which this
* ScheduleBuilder is given to.
*
* @see TriggerBuilder#withSchedule(ScheduleBuilder)
*/
@Override
public MutableTrigger build() {
DailyTimeIntervalTriggerImpl st = new DailyTimeIntervalTriggerImpl();
st.setRepeatInterval(interval);
st.setRepeatIntervalUnit(intervalUnit);
st.setMisfireInstruction(misfireInstruction);
st.setRepeatCount(repeatCount);
if(daysOfWeek != null)
st.setDaysOfWeek(daysOfWeek);
else
st.setDaysOfWeek(ALL_DAYS_OF_THE_WEEK);
if(startTimeOfDay != null)
st.setStartTimeOfDay(startTimeOfDay);
else
st.setStartTimeOfDay(TimeOfDay.hourAndMinuteOfDay(0, 0));
if(endTimeOfDay != null)
st.setEndTimeOfDay(endTimeOfDay);
else
st.setEndTimeOfDay(TimeOfDay.hourMinuteAndSecondOfDay(23, 59, 59));
return st;
}
示例8: build
import org.quartz.spi.MutableTrigger; //导入依赖的package包/类
/**
* Build the actual Trigger -- NOT intended to be invoked by end users,
* but will rather be invoked by a TriggerBuilder which this
* ScheduleBuilder is given to.
*
* @see TriggerBuilder#withSchedule(ScheduleBuilder)
*/
@Override
public MutableTrigger build() {
CalendarIntervalTriggerImpl st = new CalendarIntervalTriggerImpl();
st.setRepeatInterval(interval);
st.setRepeatIntervalUnit(intervalUnit);
st.setMisfireInstruction(misfireInstruction);
st.setTimeZone(timeZone);
st.setPreserveHourOfDayAcrossDaylightSavings(preserveHourOfDayAcrossDaylightSavings);
st.setSkipDayIfHourDoesNotExist(skipDayIfHourDoesNotExist);
return st;
}
示例9: buildTrigger
import org.quartz.spi.MutableTrigger; //导入依赖的package包/类
@Override
public MutableTrigger buildTrigger(String config) {
JSONObject configObj = JSON.parseObject(config);
switch (configObj.getString("type")) {
case "cron":
String cron = configObj.getString("config");
return CronScheduleBuilder.cronSchedule(cron)
.build();
default:
throw new UnsupportedOperationException(config);
}
}
示例10: getScheduleBuilder
import org.quartz.spi.MutableTrigger; //导入依赖的package包/类
@Override
@JsonIgnore
public ScheduleBuilder getScheduleBuilder() {
return new ScheduleBuilder<SimpleTrigger>() {
@Override
protected MutableTrigger build() {
return SimpleScheduleBuilder.simpleSchedule()
.withRepeatCount(repeatCount)
.withIntervalInMilliseconds(repeatInterval)
.withMisfireHandlingInstructionNextWithRemainingCount()
.build();
}
};
}
示例11: build
import org.quartz.spi.MutableTrigger; //导入依赖的package包/类
/**
* Build the actual Trigger -- NOT intended to be invoked by end users,
* but will rather be invoked by a TriggerBuilder which this
* ScheduleBuilder is given to.
*/
@Override
public MutableTrigger build() {
PeriodIntervalTriggerImpl pt = new PeriodIntervalTriggerImpl();
pt.setRepeatPeriod(repeatPeriod);
pt.setMisfireInstruction(misfireInstruction);
return pt;
}
示例12: addTriggerToSchedule
import org.quartz.spi.MutableTrigger; //导入依赖的package包/类
protected void addTriggerToSchedule(MutableTrigger trigger) {
loadedTriggers.add(trigger);
}
示例13: build
import org.quartz.spi.MutableTrigger; //导入依赖的package包/类
@Override
protected MutableTrigger build() {
OnDemandTrigger onDemandTrigger = new OnDemandTrigger();
onDemandTrigger.setMisfireInstruction(MISFIRE_INSTRUCTION_FIRE_NOW);
return onDemandTrigger;
}
示例14: getLoadedTriggers
import org.quartz.spi.MutableTrigger; //导入依赖的package包/类
/**
* Returns a <code>List</code> of triggers loaded from the xml file.
* <p/>
*
* @return a <code>List</code> of triggers.
*/
protected List<MutableTrigger> getLoadedTriggers() {
return Collections.unmodifiableList(loadedTriggers);
}
示例15: build
import org.quartz.spi.MutableTrigger; //导入依赖的package包/类
protected abstract MutableTrigger build();