Java Code Examples for org.quartz.SimpleTrigger#getRepeatCount()

The following examples show how to use org.quartz.SimpleTrigger#getRepeatCount() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleTriggerSupport.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public static CompositeData toCompositeData(SimpleTrigger trigger) {
    try {
        return new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES,
                new Object[] {
                        trigger.getRepeatCount(),
                        trigger.getRepeatInterval(),
                        trigger.getTimesTriggered(),
                        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);
    }
}
 
Example 2
Source File: SparkSubmitJob.java    From griffin with Apache License 2.0 5 votes vote down vote up
private void updateJobInstanceState(JobExecutionContext context)
    throws IOException {
    SimpleTrigger simpleTrigger = (SimpleTrigger) context.getTrigger();
    int repeatCount = simpleTrigger.getRepeatCount();
    int fireCount = simpleTrigger.getTimesTriggered();
    if (fireCount > repeatCount) {
        saveJobInstance(null, NOT_FOUND);
    }
}
 
Example 3
Source File: SchedulerController.java    From quartz-manager with Apache License 2.0 5 votes vote down vote up
@GetMapping("/config")
public SchedulerConfigParam getConfig() {
	log.debug("SCHEDULER - GET CONFIG params");
	SimpleTrigger simpleTrigger = (SimpleTrigger) triggerMonitor.getTrigger();

	int maxCount = simpleTrigger.getRepeatCount() + 1;
	long triggersPerDay = fromMillsIntervalToTriggerPerDay(simpleTrigger.getRepeatInterval());

	return new SchedulerConfigParam(triggersPerDay, maxCount);
}
 
Example 4
Source File: WebSocketProgressNotifier.java    From quartz-manager with Apache License 2.0 5 votes vote down vote up
@Override
public void send() throws SchedulerException {
	TriggerStatus currTriggerStatus = new TriggerStatus();

	Trigger trigger = scheduler.getTrigger(triggerMonitor.getTrigger().getKey());
	currTriggerStatus.setFinalFireTime(trigger.getFinalFireTime());
	currTriggerStatus.setNextFireTime(trigger.getNextFireTime());
	currTriggerStatus.setPreviousFireTime(trigger.getPreviousFireTime());

	int timesTriggered = 0;
	int repeatCount = 0;

	if (trigger instanceof SimpleTrigger) {
		SimpleTrigger simpleTrigger = (SimpleTrigger) trigger;
		timesTriggered = simpleTrigger.getTimesTriggered();
		repeatCount = simpleTrigger.getRepeatCount();
	} else if (trigger instanceof DailyTimeIntervalTrigger) {
		DailyTimeIntervalTrigger dailyTrigger = (DailyTimeIntervalTrigger) trigger;
		timesTriggered = dailyTrigger.getTimesTriggered();
		repeatCount = dailyTrigger.getRepeatCount();
	}

	Trigger jobTrigger = triggerMonitor.getTrigger();
	if (jobTrigger != null && jobTrigger.getJobKey() != null) {
		currTriggerStatus.setJobKey(jobTrigger.getJobKey().getName());
		currTriggerStatus.setJobClass(jobTrigger.getClass().getSimpleName());
		currTriggerStatus.setTimesTriggered(timesTriggered);
		currTriggerStatus.setRepeatCount(repeatCount + 1);
	}

	messagingTemplate.convertAndSend("/topic/progress", currTriggerStatus);
}