本文整理了Java中org.quartz.Trigger.getStartTime()
方法的一些代码示例,展示了Trigger.getStartTime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Trigger.getStartTime()
方法的具体详情如下:
包路径:org.quartz.Trigger
类名称:Trigger
方法名:getStartTime
[英]Get the time at which the Trigger
should occur.
[中]获取Trigger
应该发生的时间。
代码示例来源:origin: azkaban/azkaban
private void ajaxFetchTrigger(final int projectId, final String flowId, final Session session,
final HashMap<String,
Object> ret) {
final ScheduledFlowTrigger res = this.scheduler
.getScheduledFlowTriggerJobs().stream().filter(
scheduledFlowTrigger -> scheduledFlowTrigger.getFlowId().equals(flowId)
&& scheduledFlowTrigger.getProjectId
() == projectId).findFirst().orElse(null);
if (res != null) {
final Map<String, Object> jsonObj = new HashMap<>();
jsonObj.put("cronExpression", res.getFlowTrigger().getSchedule().getCronExpression());
jsonObj.put("submitUser", res.getSubmitUser());
jsonObj.put("firstSchedTime",
utils.formatDateTime(res.getQuartzTrigger().getStartTime().getTime()));
jsonObj.put("nextExecTime",
utils.formatDateTime(res.getQuartzTrigger().getNextFireTime().getTime()));
Long maxWaitMin = null;
if (res.getFlowTrigger().getMaxWaitDuration().isPresent()) {
maxWaitMin = res.getFlowTrigger().getMaxWaitDuration().get().toMinutes();
}
jsonObj.put("maxWaitMin", maxWaitMin);
if (!res.getFlowTrigger().getDependencies().isEmpty()) {
jsonObj.put("dependencies", res.getDependencyListJson());
}
ret.put("flowTrigger", jsonObj);
}
}
代码示例来源:origin: kiegroup/jbpm
.build();
logger.debug("triggerq.name = {}, triggerq.startTime = {}", triggerq.getKey().getName(), triggerq.getStartTime()); // nextFireTime is mapped to startTime
代码示例来源: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: com.opensymphony.quartz/com.springsource.org.quartz
public void addTrigger(Trigger trigger) {
if (trigger.getStartTime() == null) {
trigger.setStartTime(new Date());
}
triggers.add(trigger);
}
代码示例来源:origin: quartz/quartz-all
public void addTrigger(Trigger trigger) {
if (trigger.getStartTime() == null) {
trigger.setStartTime(new Date());
}
triggers.add(trigger);
}
代码示例来源:origin: org.motechproject/motech-scheduler
private String getStartDate(JobKey jobKey) throws SchedulerException {
Trigger trigger = scheduler.getTriggersOfJob(jobKey).get(0);
return DateTimeFormat.forPattern("Y-MM-dd HH:mm:ss").print(trigger.getStartTime().getTime());
}
代码示例来源:origin: org.ikasan/ikasan-scheduler
@Override public void triggerComplete(Trigger trigger, JobExecutionContext context,
Trigger.CompletedExecutionInstruction triggerInstructionCode)
{
if(logger.isDebugEnabled())
{
logger.debug(getName() + " Trigger complete for [" + trigger.getKey() + "] at " + trigger.getStartTime()
+ " for job [" + context.getJobDetail().getKey());
}
}
}
代码示例来源:origin: org.ikasan/ikasan-scheduler
@Override public void triggerFired(Trigger trigger, JobExecutionContext context)
{
if(logger.isDebugEnabled())
{
logger.debug(getName() + " Trigger fired for [" + trigger.getKey() + "] at " + trigger.getStartTime()
+ " for job [" + trigger.getJobKey());
}
}
代码示例来源:origin: org.kuali.kfs/kfs-core
/**
* @see org.kuali.kfs.sys.batch.TriggerDescriptor#completeTriggerDescription(org.quartz.Trigger)
*/
protected void completeTriggerDescription(Trigger trigger) {
if (startTime == null) {
startTime = trigger.getStartTime();
}
// prevent setting of the trigger information in test mode
if (!isTestMode()) {
trigger.setStartTime(new Date(startTime.getTime() + startDelay));
((SimpleTrigger) trigger).setRepeatCount(repeatCount);
}
else {
trigger.setStartTime(new Date(new Date().getTime() + 525600000L));
}
}
代码示例来源: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: org.ikasan/ikasan-scheduler
@Override public void triggerMisfired(Trigger trigger)
{
logger.warn(getName() + " Misfire. Trigger [" + trigger.getKey() + "] misfired at " + trigger.getStartTime()
+ " for job [" + trigger.getJobKey());
}
代码示例来源: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: 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.kuali.kpme/kpme-tk-lm-impl
private void rescheduleJob(JobExecutionContext context) throws JobExecutionException {
try {
Scheduler scheduler = context.getScheduler();
Trigger oldTrigger = context.getTrigger();
DateTime newStartTime = new DateTime().plusMinutes(5);
String newTriggerName = BatchJobUtil.getTriggerName(SupervisorApprovalJob.class, newStartTime);
Trigger newTrigger = new SimpleTrigger(newTriggerName, oldTrigger.getGroup(), newStartTime.toDate());
newTrigger.setJobName(oldTrigger.getJobName());
newTrigger.setJobGroup(oldTrigger.getJobGroup());
LOG.info("Rescheduing " + newTrigger.getFullJobName() + " to be run on " + newTrigger.getStartTime());
scheduler.rescheduleJob(oldTrigger.getName(), oldTrigger.getGroup(), newTrigger);
} catch (SchedulerException se) {
LOG.error("Failure to execute job due to SchedulerException", se);
// throw new JobExecutionException(se);
}
}
代码示例来源:origin: org.kuali.kpme/kpme-tk-lm-impl
private void rescheduleJob(JobExecutionContext context) throws JobExecutionException {
try {
Scheduler scheduler = context.getScheduler();
Trigger oldTrigger = context.getTrigger();
DateTime newStartTime = new DateTime().plusMinutes(5);
String newTriggerName = BatchJobUtil.getTriggerName(PayrollApprovalJob.class, newStartTime);
Trigger newTrigger = new SimpleTrigger(newTriggerName, oldTrigger.getGroup(), newStartTime.toDate());
newTrigger.setJobName(oldTrigger.getJobName());
newTrigger.setJobGroup(oldTrigger.getJobGroup());
LOG.info("Rescheduing " + newTrigger.getFullJobName() + " to be run on " + newTrigger.getStartTime());
scheduler.rescheduleJob(oldTrigger.getName(), oldTrigger.getGroup(), newTrigger);
} catch (SchedulerException se) {
LOG.error("Failure to execute job due to SchedulerException", se);
// throw new JobExecutionException(se);
}
}
代码示例来源: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: 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;
}
内容来源于网络,如有侵权,请联系作者删除!