Java Code Examples for org.quartz.impl.triggers.SimpleTriggerImpl#setMisfireInstruction()

The following examples show how to use org.quartz.impl.triggers.SimpleTriggerImpl#setMisfireInstruction() . 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: SimpleTriggerFactoryBean.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public void afterPropertiesSet() {
	if (this.name == null) {
		this.name = this.beanName;
	}
	if (this.group == null) {
		this.group = Scheduler.DEFAULT_GROUP;
	}
	if (this.jobDetail != null) {
		this.jobDataMap.put("jobDetail", this.jobDetail);
	}
	if (this.startDelay > 0 || this.startTime == null) {
		this.startTime = new Date(System.currentTimeMillis() + this.startDelay);
	}

	SimpleTriggerImpl sti = new SimpleTriggerImpl();
	sti.setName(this.name != null ? this.name : toString());
	sti.setGroup(this.group);
	if (this.jobDetail != null) {
		sti.setJobKey(this.jobDetail.getKey());
	}
	sti.setJobDataMap(this.jobDataMap);
	sti.setStartTime(this.startTime);
	sti.setRepeatInterval(this.repeatInterval);
	sti.setRepeatCount(this.repeatCount);
	sti.setPriority(this.priority);
	sti.setMisfireInstruction(this.misfireInstruction);
	sti.setDescription(this.description);
	this.simpleTrigger = sti;
}
 
Example 2
Source File: SimpleTriggerFactoryBean.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public void afterPropertiesSet() {
	if (this.name == null) {
		this.name = this.beanName;
	}
	if (this.group == null) {
		this.group = Scheduler.DEFAULT_GROUP;
	}
	if (this.jobDetail != null) {
		this.jobDataMap.put("jobDetail", this.jobDetail);
	}
	if (this.startDelay > 0 || this.startTime == null) {
		this.startTime = new Date(System.currentTimeMillis() + this.startDelay);
	}

	SimpleTriggerImpl sti = new SimpleTriggerImpl();
	sti.setName(this.name != null ? this.name : toString());
	sti.setGroup(this.group);
	if (this.jobDetail != null) {
		sti.setJobKey(this.jobDetail.getKey());
	}
	sti.setJobDataMap(this.jobDataMap);
	sti.setStartTime(this.startTime);
	sti.setRepeatInterval(this.repeatInterval);
	sti.setRepeatCount(this.repeatCount);
	sti.setPriority(this.priority);
	sti.setMisfireInstruction(this.misfireInstruction);
	sti.setDescription(this.description);
	this.simpleTrigger = sti;
}
 
Example 3
Source File: SimpleTriggerFactoryBean.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void afterPropertiesSet() {
	if (this.name == null) {
		this.name = this.beanName;
	}
	if (this.group == null) {
		this.group = Scheduler.DEFAULT_GROUP;
	}
	if (this.jobDetail != null) {
		this.jobDataMap.put("jobDetail", this.jobDetail);
	}
	if (this.startDelay > 0 || this.startTime == null) {
		this.startTime = new Date(System.currentTimeMillis() + this.startDelay);
	}

	SimpleTriggerImpl sti = new SimpleTriggerImpl();
	sti.setName(this.name);
	sti.setGroup(this.group);
	if (this.jobDetail != null) {
		sti.setJobKey(this.jobDetail.getKey());
	}
	sti.setJobDataMap(this.jobDataMap);
	sti.setStartTime(this.startTime);
	sti.setRepeatInterval(this.repeatInterval);
	sti.setRepeatCount(this.repeatCount);
	sti.setPriority(this.priority);
	sti.setMisfireInstruction(this.misfireInstruction);
	sti.setDescription(this.description);
	this.simpleTrigger = sti;
}
 
Example 4
Source File: DefaultClusteredJobStore.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected OperableTrigger createRecoveryTrigger(TriggerWrapper tw, JobWrapper jw,
                                                String name, FiredTrigger recovering) {
  final SimpleTriggerImpl recoveryTrigger = new SimpleTriggerImpl(name, Scheduler.DEFAULT_RECOVERY_GROUP, new Date(recovering.getScheduledFireTime()));
  recoveryTrigger.setJobName(jw.getKey().getName());
  recoveryTrigger.setJobGroup(jw.getKey().getGroup());
  recoveryTrigger.setMisfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY);
  recoveryTrigger.setPriority(tw.getPriority());
  return recoveryTrigger;
}
 
Example 5
Source File: SimpleScheduleBuilder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 6
Source File: SimpleTriggerFactoryBean.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void afterPropertiesSet() {
	if (this.name == null) {
		this.name = this.beanName;
	}
	if (this.group == null) {
		this.group = Scheduler.DEFAULT_GROUP;
	}
	if (this.jobDetail != null) {
		this.jobDataMap.put("jobDetail", this.jobDetail);
	}
	if (this.startDelay > 0 || this.startTime == null) {
		this.startTime = new Date(System.currentTimeMillis() + this.startDelay);
	}

	SimpleTriggerImpl sti = new SimpleTriggerImpl();
	sti.setName(this.name);
	sti.setGroup(this.group);
	sti.setJobKey(this.jobDetail.getKey());
	sti.setJobDataMap(this.jobDataMap);
	sti.setStartTime(this.startTime);
	sti.setRepeatInterval(this.repeatInterval);
	sti.setRepeatCount(this.repeatCount);
	sti.setPriority(this.priority);
	sti.setMisfireInstruction(this.misfireInstruction);
	sti.setDescription(this.description);
	this.simpleTrigger = sti;
}
 
Example 7
Source File: StdJDBCDelegate.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * <p>
 * Select all of the triggers for jobs that are requesting recovery. The
 * returned trigger objects will have unique "recoverXXX" trigger names and
 * will be in the <code>{@link
 * org.quartz.Scheduler}.DEFAULT_RECOVERY_GROUP</code>
 * trigger group.
 * </p>
 * 
 * <p>
 * In order to preserve the ordering of the triggers, the fire time will be
 * set from the <code>COL_FIRED_TIME</code> column in the <code>TABLE_FIRED_TRIGGERS</code>
 * table. The caller is responsible for calling <code>computeFirstFireTime</code>
 * on each returned trigger. It is also up to the caller to insert the
 * returned triggers to ensure that they are fired.
 * </p>
 * 
 * @param conn
 *          the DB Connection
 * @return an array of <code>{@link org.quartz.Trigger}</code> objects
 */
public List<OperableTrigger> selectTriggersForRecoveringJobs(Connection conn)
    throws SQLException, IOException, ClassNotFoundException {
    PreparedStatement ps = null;
    ResultSet rs = null;

    try {
        ps = conn
                .prepareStatement(rtp(SELECT_INSTANCES_RECOVERABLE_FIRED_TRIGGERS));
        ps.setString(1, instanceId);
        setBoolean(ps, 2, true);
        rs = ps.executeQuery();

        long dumId = System.currentTimeMillis();
        LinkedList<OperableTrigger> list = new LinkedList<OperableTrigger>();
        while (rs.next()) {
            String jobName = rs.getString(COL_JOB_NAME);
            String jobGroup = rs.getString(COL_JOB_GROUP);
            String trigName = rs.getString(COL_TRIGGER_NAME);
            String trigGroup = rs.getString(COL_TRIGGER_GROUP);
            long firedTime = rs.getLong(COL_FIRED_TIME);
            long scheduledTime = rs.getLong(COL_SCHED_TIME);
            int priority = rs.getInt(COL_PRIORITY);
            @SuppressWarnings("deprecation")
            SimpleTriggerImpl rcvryTrig = new SimpleTriggerImpl("recover_"
                    + instanceId + "_" + String.valueOf(dumId++),
                    Scheduler.DEFAULT_RECOVERY_GROUP, new Date(scheduledTime));
            rcvryTrig.setJobName(jobName);
            rcvryTrig.setJobGroup(jobGroup);
            rcvryTrig.setPriority(priority);
            rcvryTrig.setMisfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY);

            JobDataMap jd = selectTriggerJobDataMap(conn, trigName, trigGroup);
            jd.put(Scheduler.FAILED_JOB_ORIGINAL_TRIGGER_NAME, trigName);
            jd.put(Scheduler.FAILED_JOB_ORIGINAL_TRIGGER_GROUP, trigGroup);
            jd.put(Scheduler.FAILED_JOB_ORIGINAL_TRIGGER_FIRETIME_IN_MILLISECONDS, String.valueOf(firedTime));
            jd.put(Scheduler.FAILED_JOB_ORIGINAL_TRIGGER_SCHEDULED_FIRETIME_IN_MILLISECONDS, String.valueOf(scheduledTime));
            rcvryTrig.setJobDataMap(jd);
            
            list.add(rcvryTrig);
        }
        return list;
    } finally {
        closeResultSet(rs);
        closeStatement(ps);
    }
}