本文整理了Java中org.quartz.Trigger.getEndTime()
方法的一些代码示例,展示了Trigger.getEndTime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Trigger.getEndTime()
方法的具体详情如下:
包路径:org.quartz.Trigger
类名称:Trigger
方法名:getEndTime
[英]Get the time at which the Trigger
should quit repeating - regardless of any remaining repeats (based on the trigger's particular repeat settings).
[中]获取Trigger
应该停止重复的时间,不管是否有剩余的重复(基于触发器的特定重复设置)。
代码示例来源:origin: quartz-scheduler/quartz
public static CompositeData toCompositeData(Trigger trigger) {
try {
return new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES,
new Object[] {
trigger.getKey().getName(),
trigger.getKey().getGroup(),
trigger.getJobKey().getName(),
trigger.getJobKey().getGroup(),
trigger.getDescription(),
JobDataMapSupport.toTabularData(trigger
.getJobDataMap()),
trigger.getCalendarName(),
((OperableTrigger)trigger).getFireInstanceId(),
trigger.getMisfireInstruction(),
trigger.getPriority(), trigger.getStartTime(),
trigger.getEndTime(), trigger.getNextFireTime(),
trigger.getPreviousFireTime(),
trigger.getFinalFireTime() });
} catch (OpenDataException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.motechproject/motech-scheduler
private String getEndDate(JobKey jobKey, String jobType) throws SchedulerException {
Trigger trigger = scheduler.getTriggersOfJob(jobKey).get(0);
DateTime endDateTime = new DateTime(trigger.getEndTime());
String startDate = getStartDate(jobKey);
String endDate;
if (!endDateTime.isAfterNow()) {
if (jobType.equals(JobBasicInfo.JOBTYPE_RUNONCE)) {
endDate = startDate;
} else {
endDate = "-";
}
} else {
endDate = DateTimeFormat.forPattern("Y-MM-dd HH:mm:ss").print(endDateTime);
}
return endDate;
}
代码示例来源:origin: org.motechproject/motech-scheduler
private String getJobActivity(JobKey jobKey) throws SchedulerException {
Trigger trigger = scheduler.getTriggersOfJob(jobKey).get(0);
DateTime startDateTime = new DateTime(trigger.getStartTime());
DateTime endDateTime = new DateTime(trigger.getEndTime());
if (startDateTime.isAfterNow()) {
return JobBasicInfo.ACTIVITY_NOTSTARTED;
} else if (endDateTime.isBeforeNow()) {
return JobBasicInfo.ACTIVITY_FINISHED;
} else {
return JobBasicInfo.ACTIVITY_ACTIVE;
}
}
代码示例来源:origin: robeio/robe
public List<JobKey> getGeneralReport() throws SchedulerException {
//TODO: sout is only for dev. Will change after deciding report
List<JobKey> jobKeys = new LinkedList<>();
for (String groupName : scheduler.getJobGroupNames()) {
for (JobKey jobKey : scheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
for (Trigger trigger : getTriggersOfJob(jobKey)) {
StringBuilder builder = new StringBuilder();
builder.append(jobKey.getGroup()).append(" ,");
builder.append(jobKey.getName()).append(" ,");
builder.append(trigger.getKey()).append(" ,");
builder.append(trigger.getDescription()).append(" ,");
builder.append(trigger.getStartTime()).append(" ,");
builder.append(trigger.getEndTime()).append(" ,");
builder.append(trigger.getPreviousFireTime()).append(" ,");
builder.append(trigger.getNextFireTime()).append(" ,");
builder.append(getTriggerStatus(trigger.getKey()).name());
System.out.println(builder.toString());
}
}
}
return jobKeys;
}
代码示例来源:origin: org.motechproject/motech-scheduler
private String getJobInfo(JobKey jobKey, String jobType) throws SchedulerException {
Trigger trigger = scheduler.getTriggersOfJob(jobKey).get(0);
if (jobType.equals(JobBasicInfo.JOBTYPE_REPEATING)) {
Integer timesTriggered = 0;
String repeatMaxCount = "-";
if (trigger instanceof CalendarIntervalTrigger) {
CalendarIntervalTrigger calendarIntervalTrigger = (CalendarIntervalTrigger) trigger;
timesTriggered = calendarIntervalTrigger.getTimesTriggered();
} else if (trigger instanceof SimpleTrigger) {
SimpleTrigger simpleTrigger = (SimpleTrigger) trigger;
timesTriggered = simpleTrigger.getTimesTriggered();
}
if (trigger.getEndTime() != null) {
repeatMaxCount = Integer.toString(TriggerUtils.computeFireTimesBetween(
(OperableTrigger) trigger, null, trigger.getStartTime(), trigger.getEndTime()
).size() + timesTriggered);
}
return String.format("%d/%s", timesTriggered, repeatMaxCount);
} else if (jobType.equals(JobBasicInfo.JOBTYPE_CRON)) {
CronScheduleBuilder cronScheduleBuilder = (CronScheduleBuilder) trigger.getScheduleBuilder();
CronTrigger cronTrigger = (CronTrigger) cronScheduleBuilder.build();
return cronTrigger.getCronExpression();
} else {
return "-";
}
}
代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz
.getStartTime().getTime())));
long endTime = 0;
if (trigger.getEndTime() != null) {
endTime = trigger.getEndTime().getTime();
代码示例来源:origin: quartz/quartz-all
.getStartTime().getTime())));
long endTime = 0;
if (trigger.getEndTime() != null) {
endTime = trigger.getEndTime().getTime();
代码示例来源:origin: quartz/quartz-all
.getStartTime().getTime())));
long endTime = 0;
if (trigger.getEndTime() != null) {
endTime = trigger.getEndTime().getTime();
代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz
.getStartTime().getTime())));
long endTime = 0;
if (trigger.getEndTime() != null) {
endTime = trigger.getEndTime().getTime();
代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz
.getStartTime().getTime())));
long endTime = 0;
if (trigger.getEndTime() != null) {
endTime = trigger.getEndTime().getTime();
代码示例来源:origin: org.motechproject/motech-scheduler
motechEvent.setEndTime(trigger.getEndTime())
.setLastEvent(!trigger.mayFireAgain());
代码示例来源:origin: bingoohuang/quartz-glass
public CronTriggerForm(Trigger trigger) {
this.startTime = Dates.copy(trigger.getStartTime());
this.endTime = Dates.copy(trigger.getEndTime());
this.dataMap = JobDataMapUtils.toProperties(trigger.getJobDataMap());
this.cronExpression = ((CronTrigger) trigger).getCronExpression();
}
代码示例来源:origin: org.finra.herd/herd-service
trigger.getEndTime(), trigger.getFinalFireTime(), trigger.getJobKey(), trigger.getKey(), trigger.getMisfireInstruction(), trigger.getNextFireTime(),
trigger.getPreviousFireTime(), trigger.getPriority(), trigger.getStartTime()));
代码示例来源:origin: bingoohuang/quartz-glass
public SimpleTriggerForm(Trigger trigger) {
this.startTime = Dates.copy(trigger.getStartTime());
this.endTime = Dates.copy(trigger.getEndTime());
this.dataMap = JobDataMapUtils.toProperties(trigger.getJobDataMap());
this.repeatCount = ((SimpleTrigger) trigger).getRepeatCount();
this.intervalInMilliseconds = (int) ((SimpleTrigger) trigger).getRepeatInterval();
}
代码示例来源:origin: FINRAOS/herd
trigger.getEndTime(), trigger.getFinalFireTime(), trigger.getJobKey(), trigger.getKey(), trigger.getMisfireInstruction(), trigger.getNextFireTime(),
trigger.getPreviousFireTime(), trigger.getPriority(), trigger.getStartTime()));
代码示例来源:origin: io.eventcenter/ec-scheduler
@Override
public List<TriggerState> getTriggerStates() throws ECSchedulerException {
try {
Set<TriggerKey> keys = scheduler.getTriggerKeys(GroupMatcher.anyTriggerGroup());
List<TriggerState> list = new ArrayList<TriggerState>();
if(keys.size() == 0) {
return list;
}
for(TriggerKey key : keys){
Trigger trigger = scheduler.getTrigger(key);
JobDetail job = scheduler.getJobDetail(JobKey.jobKey(key.getName()));
if(null == trigger)
continue;
TriggerState state = new TriggerState();
state.setEventInfo((EventInfo)job.getJobDataMap().get(QuartzConstants.DATA_EVENT_INFO));
state.setId(key.getName());
ScheduleState ss = new ScheduleState();
ss.setStartTime(trigger.getStartTime());
ss.setEndTime(trigger.getEndTime());
ss.setNextFireTime(trigger.getNextFireTime());
ss.setPreviousFireTime(trigger.getPreviousFireTime());
state.setScheduleState(ss);
list.add(state);
}
return list;
} catch (SchedulerException e) {
throw new ECSchedulerException(e);
}
}
代码示例来源:origin: org.seedstack.seed/seed-scheduling-support
SchedulingContextImpl(JobExecutionContext context) {
taskName = context.getJobDetail().getKey().getName();
storeDurably = context.getJobDetail().isDurable();
requestRecovery = context.getJobDetail().requestsRecovery();
scheduledFireDate = context.getScheduledFireTime();
currentFireDate = context.getFireTime();
previousFireDate = context.getPreviousFireTime();
nextFireDate = context.getNextFireTime();
taskRuntime = context.getJobRunTime();
triggerRefireCount = context.getRefireCount();
triggerEndDate = context.getTrigger().getEndTime();
triggerFinalFireDate = context.getTrigger().getFinalFireTime();
triggerName = context.getTrigger().getKey().getName();
triggerStartDate = context.getTrigger().getStartTime();
triggerPriority = context.getTrigger().getPriority();
}
代码示例来源:origin: nkcoder/quartz-explained
public static CompositeData toCompositeData(Trigger trigger) {
try {
return new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES,
new Object[] {
trigger.getKey().getName(),
trigger.getKey().getGroup(),
trigger.getJobKey().getName(),
trigger.getJobKey().getGroup(),
trigger.getDescription(),
JobDataMapSupport.toTabularData(trigger
.getJobDataMap()),
trigger.getCalendarName(),
((OperableTrigger)trigger).getFireInstanceId(),
trigger.getMisfireInstruction(),
trigger.getPriority(), trigger.getStartTime(),
trigger.getEndTime(), trigger.getNextFireTime(),
trigger.getPreviousFireTime(),
trigger.getFinalFireTime() });
} catch (OpenDataException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: jiuxiantuan/mossrose
private JobRuntimeInfo getJobInfoByKey(final JobKey jobKey) {
JobRuntimeInfo job = null;
try {
final JobDetail jobDetail = scheduler.getJobDetail(jobKey);
// Only one trigger for a job
final Trigger trigger = Iterables.getFirst(scheduler.getTriggersOfJob(jobKey), null);
if (trigger != null) {
job = new JobRuntimeInfo();
job.setId(jobKey.getName());
job.setGroup(jobKey.getGroup());
job.setDescription(jobDetail.getDescription());
job.setStartTime(trigger.getStartTime());
job.setEndTime(trigger.getEndTime());
job.setPreviousFireTime(trigger.getPreviousFireTime());
job.setNextFireTime(trigger.getNextFireTime());
job.setState(State.valueOf(scheduler.getTriggerState(trigger.getKey()).name()));
if (trigger instanceof CronTrigger) {
job.setCron(((CronTrigger) trigger).getCronExpression());
}
}
} catch (SchedulerException eInGettingJobInfo) {
LOGGER.error(eInGettingJobInfo.getMessage(), eInGettingJobInfo);
}
return job;
}
代码示例来源:origin: bingoohuang/quartz-glass
public static TriggerWrapperForView fromTrigger(Trigger trigger, Scheduler scheduler) throws SchedulerException {
List<JobExecutionContext> runningJobs = scheduler.getCurrentlyExecutingJobs();
TriggerWrapperForView wrapper = new TriggerWrapperForView();
wrapper.trigger = trigger;
wrapper.group = trigger.getKey().getGroup();
wrapper.name = trigger.getKey().getName();
wrapper.triggerKey = Keys.desc(trigger.getKey());
wrapper.startTime = trigger.getStartTime();
wrapper.endTime = trigger.getEndTime();
wrapper.paused = scheduler.getTriggerState(trigger.getKey()) == Trigger.TriggerState.PAUSED;
wrapper.dataMap = JobDataMapUtils.toProperties(trigger.getJobDataMap());
wrapper.glassScheduler = trigger.getJobDataMap().getString(GlassConstants.GLASS_SCHEDULER);
if ( wrapper.glassScheduler == null && trigger instanceof CronTrigger) {
CronTrigger cronTrigger = (CronTrigger) trigger;
wrapper.glassScheduler = cronTrigger.getCronExpression();
}
if ( wrapper.glassScheduler == null) wrapper.glassScheduler = "";
for (JobExecutionContext executionContext : runningJobs) {
if (executionContext.getTrigger().equals(trigger)) {
wrapper.running = true;
break;
}
}
return wrapper;
}
内容来源于网络,如有侵权,请联系作者删除!