org.quartz.Trigger.getPreviousFireTime()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(10.7k)|赞(0)|评价(0)|浏览(271)

本文整理了Java中org.quartz.Trigger.getPreviousFireTime()方法的一些代码示例,展示了Trigger.getPreviousFireTime()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Trigger.getPreviousFireTime()方法的具体详情如下:
包路径:org.quartz.Trigger
类名称:Trigger
方法名:getPreviousFireTime

Trigger.getPreviousFireTime介绍

[英]Returns the previous time at which the Trigger fired. If the trigger has not yet fired, null will be returned.
[中]返回上次触发Trigger的时间。如果触发器尚未触发,null将被返回。

代码示例

代码示例来源:origin: javamelody/javamelody

Date getTriggerPreviousFireTime(Trigger trigger) {
  return trigger.getPreviousFireTime();
}

代码示例来源:origin: elasticjob/elastic-job-lite

@Override
  public void triggerMisfired(final Trigger trigger) {
    if (null != trigger.getPreviousFireTime()) {
      executionService.setMisfire(shardingService.getLocalShardingItems());
    }
  }
}

代码示例来源:origin: quartz-scheduler/quartz

public void triggerFired(Trigger trigger, JobExecutionContext context) {
  if (!getLog().isInfoEnabled()) {
    return;
  } 
  
  Object[] args = {
    trigger.getKey().getName(), trigger.getKey().getGroup(),
    trigger.getPreviousFireTime(), trigger.getNextFireTime(),
    new java.util.Date(), context.getJobDetail().getKey().getName(),
    context.getJobDetail().getKey().getGroup(),
    Integer.valueOf(context.getRefireCount())
  };
  getLog().info(MessageFormat.format(getTriggerFiredMessage(), args));
}

代码示例来源:origin: quartz-scheduler/quartz

public void triggerFired(Trigger trigger, JobExecutionContext context) {
  if (!getLog().isInfoEnabled()) {
    return;
  } 
  
  Object[] args = {
    trigger.getKey().getName(), trigger.getKey().getGroup(),
    trigger.getPreviousFireTime(), trigger.getNextFireTime(),
    new java.util.Date(), context.getJobDetail().getKey().getName(),
    context.getJobDetail().getKey().getGroup(),
    Integer.valueOf(context.getRefireCount())
  };
  getLog().info(MessageFormat.format(getTriggerFiredMessage(), args));
}

代码示例来源:origin: quartz-scheduler/quartz

/** 
 * @see org.quartz.JobListener#jobExecutionVetoed(org.quartz.JobExecutionContext)
 */
public void jobExecutionVetoed(JobExecutionContext context) {
  
  if (!getLog().isInfoEnabled()) {
    return;
  } 
  
  Trigger trigger = context.getTrigger();
  Object[] args = {
    context.getJobDetail().getKey().getName(),
    context.getJobDetail().getKey().getGroup(), new java.util.Date(),
    trigger.getKey().getName(), trigger.getKey().getGroup(),
    trigger.getPreviousFireTime(), trigger.getNextFireTime(),
    Integer.valueOf(context.getRefireCount())
  };
  getLog().info(MessageFormat.format(getJobWasVetoedMessage(), args));
}

代码示例来源:origin: quartz-scheduler/quartz

public void triggerMisfired(Trigger trigger) {
  if (!getLog().isInfoEnabled()) {
    return;
  } 
  
  Object[] args = {
    trigger.getKey().getName(), trigger.getKey().getGroup(),
    trigger.getPreviousFireTime(), trigger.getNextFireTime(),
    new java.util.Date(), trigger.getJobKey().getName(),
    trigger.getJobKey().getGroup()
  };
  getLog().info(MessageFormat.format(getTriggerMisfiredMessage(), args));
}

代码示例来源:origin: quartz-scheduler/quartz

public void triggerMisfired(Trigger trigger) {
  if (!getLog().isInfoEnabled()) {
    return;
  } 
  
  Object[] args = {
    trigger.getKey().getName(), trigger.getKey().getGroup(),
    trigger.getPreviousFireTime(), trigger.getNextFireTime(),
    new java.util.Date(), trigger.getJobKey().getName(),
    trigger.getJobKey().getGroup()
  };
  getLog().info(MessageFormat.format(getTriggerMisfiredMessage(), args));
}

代码示例来源:origin: quartz-scheduler/quartz

/** 
 * @see org.quartz.JobListener#jobExecutionVetoed(org.quartz.JobExecutionContext)
 */
public void jobExecutionVetoed(JobExecutionContext context) {
  
  if (!getLog().isInfoEnabled()) {
    return;
  } 
  
  Trigger trigger = context.getTrigger();
  Object[] args = {
    context.getJobDetail().getKey().getName(),
    context.getJobDetail().getKey().getGroup(), new java.util.Date(),
    trigger.getKey().getName(), trigger.getKey().getGroup(),
    trigger.getPreviousFireTime(), trigger.getNextFireTime(),
    Integer.valueOf(context.getRefireCount())
  };
  getLog().info(MessageFormat.format(getJobWasVetoedMessage(), args));
}

代码示例来源:origin: quartz-scheduler/quartz

/** 
 * @see org.quartz.JobListener#jobToBeExecuted(JobExecutionContext)
 */
public void jobToBeExecuted(JobExecutionContext context) {
  if (!getLog().isInfoEnabled()) {
    return;
  } 
  
  Trigger trigger = context.getTrigger();
  Object[] args = {
    context.getJobDetail().getKey().getName(),
    context.getJobDetail().getKey().getGroup(), new java.util.Date(),
    trigger.getKey().getName(), trigger.getKey().getGroup(),
    trigger.getPreviousFireTime(), trigger.getNextFireTime(),
    Integer.valueOf(context.getRefireCount())
  };
  getLog().info(MessageFormat.format(getJobToBeFiredMessage(), args));
}

代码示例来源:origin: quartz-scheduler/quartz

/** 
 * @see org.quartz.JobListener#jobToBeExecuted(JobExecutionContext)
 */
public void jobToBeExecuted(JobExecutionContext context) {
  if (!getLog().isInfoEnabled()) {
    return;
  } 
  
  Trigger trigger = context.getTrigger();
  Object[] args = {
    context.getJobDetail().getKey().getName(),
    context.getJobDetail().getKey().getGroup(), new java.util.Date(),
    trigger.getKey().getName(), trigger.getKey().getGroup(),
    trigger.getPreviousFireTime(), trigger.getNextFireTime(),
    Integer.valueOf(context.getRefireCount())
  };
  getLog().info(MessageFormat.format(getJobToBeFiredMessage(), args));
}

代码示例来源:origin: quartz-scheduler/quartz

public void triggerComplete(Trigger trigger, JobExecutionContext context,
    CompletedExecutionInstruction triggerInstructionCode) {
  if (!getLog().isInfoEnabled()) {
    return;
  } 
  
  String instrCode = "UNKNOWN";
  if (triggerInstructionCode == CompletedExecutionInstruction.DELETE_TRIGGER) {
    instrCode = "DELETE TRIGGER";
  } else if (triggerInstructionCode == CompletedExecutionInstruction.NOOP) {
    instrCode = "DO NOTHING";
  } else if (triggerInstructionCode == CompletedExecutionInstruction.RE_EXECUTE_JOB) {
    instrCode = "RE-EXECUTE JOB";
  } else if (triggerInstructionCode == CompletedExecutionInstruction.SET_ALL_JOB_TRIGGERS_COMPLETE) {
    instrCode = "SET ALL OF JOB'S TRIGGERS COMPLETE";
  } else if (triggerInstructionCode == CompletedExecutionInstruction.SET_TRIGGER_COMPLETE) {
    instrCode = "SET THIS TRIGGER COMPLETE";
  }
  Object[] args = {
    trigger.getKey().getName(), trigger.getKey().getGroup(),
    trigger.getPreviousFireTime(), trigger.getNextFireTime(),
    new java.util.Date(), context.getJobDetail().getKey().getName(),
    context.getJobDetail().getKey().getGroup(),
    Integer.valueOf(context.getRefireCount()),
    triggerInstructionCode.toString(), instrCode
  };
  getLog().info(MessageFormat.format(getTriggerCompleteMessage(), args));
}

代码示例来源:origin: quartz-scheduler/quartz

public void triggerComplete(Trigger trigger, JobExecutionContext context,
    CompletedExecutionInstruction triggerInstructionCode) {
  if (!getLog().isInfoEnabled()) {
    return;
  } 
  
  String instrCode = "UNKNOWN";
  if (triggerInstructionCode == CompletedExecutionInstruction.DELETE_TRIGGER) {
    instrCode = "DELETE TRIGGER";
  } else if (triggerInstructionCode == CompletedExecutionInstruction.NOOP) {
    instrCode = "DO NOTHING";
  } else if (triggerInstructionCode == CompletedExecutionInstruction.RE_EXECUTE_JOB) {
    instrCode = "RE-EXECUTE JOB";
  } else if (triggerInstructionCode == CompletedExecutionInstruction.SET_ALL_JOB_TRIGGERS_COMPLETE) {
    instrCode = "SET ALL OF JOB'S TRIGGERS COMPLETE";
  } else if (triggerInstructionCode == CompletedExecutionInstruction.SET_TRIGGER_COMPLETE) {
    instrCode = "SET THIS TRIGGER COMPLETE";
  }
  Object[] args = {
    trigger.getKey().getName(), trigger.getKey().getGroup(),
    trigger.getPreviousFireTime(), trigger.getNextFireTime(),
    new java.util.Date(), context.getJobDetail().getKey().getName(),
    context.getJobDetail().getKey().getGroup(),
    Integer.valueOf(context.getRefireCount()),
    triggerInstructionCode.toString(), instrCode
  };
  getLog().info(MessageFormat.format(getTriggerCompleteMessage(), args));
}

代码示例来源:origin: quartz-scheduler/quartz

context.getJobDetail().getKey().getGroup(), new java.util.Date(),
  trigger.getKey().getName(), trigger.getKey().getGroup(),
  trigger.getPreviousFireTime(), trigger.getNextFireTime(),
  Integer.valueOf(context.getRefireCount()), errMsg
};
  context.getJobDetail().getKey().getGroup(), new java.util.Date(),
  trigger.getKey().getName(), trigger.getKey().getGroup(),
  trigger.getPreviousFireTime(), trigger.getNextFireTime(),
  Integer.valueOf(context.getRefireCount()), result
};

代码示例来源:origin: quartz-scheduler/quartz

context.getJobDetail().getKey().getGroup(), new java.util.Date(),
  trigger.getKey().getName(), trigger.getKey().getGroup(),
  trigger.getPreviousFireTime(), trigger.getNextFireTime(),
  Integer.valueOf(context.getRefireCount()), errMsg
};
  context.getJobDetail().getKey().getGroup(), new java.util.Date(),
  trigger.getKey().getName(), trigger.getKey().getGroup(),
  trigger.getPreviousFireTime(), trigger.getNextFireTime(),
  Integer.valueOf(context.getRefireCount()), result
};

代码示例来源: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.gitblit.fathom/fathom-quartz

Date getPreviousFireTime(List<? extends Trigger> triggers) {
  Date previousFireTime = null;
  for (Trigger trigger : triggers) {
    Date triggerPreviousFireTime = trigger.getPreviousFireTime();
    if (previousFireTime == null || triggerPreviousFireTime != null && previousFireTime.before(triggerPreviousFireTime)) {
      previousFireTime = triggerPreviousFireTime;
    }
  }
  return previousFireTime;
}

代码示例来源:origin: apache/incubator-griffin

@SuppressWarnings("unchecked")
private void setJobStartTime(JobDetail jobDetail)
    throws SchedulerException {
  Scheduler scheduler = factory.getScheduler();
  JobKey jobKey = jobDetail.getKey();
  List<Trigger> triggers =
      (List<Trigger>) scheduler.getTriggersOfJob(jobKey);
  Date triggerTime = triggers.get(0).getPreviousFireTime();
  jobStartTime = triggerTime.getTime();
}

代码示例来源:origin: com.dangdang/elastic-job-lite-core

@Override
  public void triggerMisfired(final Trigger trigger) {
    if (null != trigger.getPreviousFireTime()) {
      executionService.setMisfire(shardingService.getLocalShardingItems());
    }
  }
}

代码示例来源:origin: quartz/quartz-all

public void triggerMisfired(Trigger trigger) {
  if (!getLog().isInfoEnabled()) {
    return;
  } 
  
  Object[] args = {
    trigger.getName(), trigger.getGroup(),
    trigger.getPreviousFireTime(), trigger.getNextFireTime(),
    new java.util.Date(), trigger.getJobName(),
    trigger.getJobGroup()
  };
  getLog().info(MessageFormat.format(getTriggerMisfiredMessage(), args));
}

代码示例来源:origin: pl.edu.icm.synat/synat-core-services-impl

private ScheduledJobStatus fetchJobStatus(String jobId) {
  JobDefinition jobDefinition = getJobDefinition(jobId);
  JobTrigger jobTrigger = getJobTrigger(jobId);
  ScheduledJob scheduledJob = new ScheduledJob(jobId, jobDefinition, jobTrigger);
  Trigger trigger = getTrigger(jobId);
  return new ScheduledJobStatus(scheduledJob, trigger.getPreviousFireTime(), trigger.getNextFireTime());
}

相关文章