當前位置: 首頁>>代碼示例>>Java>>正文


Java SimpleTrigger.setMisfireInstruction方法代碼示例

本文整理匯總了Java中org.quartz.SimpleTrigger.setMisfireInstruction方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleTrigger.setMisfireInstruction方法的具體用法?Java SimpleTrigger.setMisfireInstruction怎麽用?Java SimpleTrigger.setMisfireInstruction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.quartz.SimpleTrigger的用法示例。


在下文中一共展示了SimpleTrigger.setMisfireInstruction方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTrigger

import org.quartz.SimpleTrigger; //導入方法依賴的package包/類
public SimpleTrigger getTrigger() throws PluggableTaskException {
    SimpleTrigger trigger = new SimpleTrigger(getTaskName(),
                                              Scheduler.DEFAULT_GROUP,
                                              getParameter(PARAM_START_TIME.getName(), DEFAULT_START_TIME),
                                              getParameter(PARAM_END_TIME.getName(), DEFAULT_END_TIME),
                                              getParameter(PARAM_REPEAT.getName(), DEFAULT_REPEAT),
                                              Long.valueOf(getParameter(PARAM_INTERVAL.getName(), DEFAULT_INTERVAL)) * 3600L * 1000L);

    trigger.setMisfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT);

    return trigger;
}
 
開發者ID:maxdelo77,項目名稱:replyit-master-3.2-final,代碼行數:13,代碼來源:AbstractSimpleScheduledTask.java

示例2: selectTriggersForRecoveringJobs

import org.quartz.SimpleTrigger; //導入方法依賴的package包/類
/**
 * <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 Trigger[] 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();
        ArrayList list = new ArrayList();
        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);
            int priority = rs.getInt(COL_PRIORITY);
            SimpleTrigger rcvryTrig = new SimpleTrigger("recover_"
                    + instanceId + "_" + String.valueOf(dumId++),
                    Scheduler.DEFAULT_RECOVERY_GROUP, new Date(firedTime));
            rcvryTrig.setJobName(jobName);
            rcvryTrig.setJobGroup(jobGroup);
            rcvryTrig.setPriority(priority);
            rcvryTrig
                    .setMisfireInstruction(SimpleTrigger.MISFIRE_INSTRUCTION_FIRE_NOW);

            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));
            rcvryTrig.setJobDataMap(jd);
            
            list.add(rcvryTrig);
        }
        Object[] oArr = list.toArray();
        Trigger[] tArr = new Trigger[oArr.length];
        System.arraycopy(oArr, 0, tArr, 0, oArr.length);
        return tArr;
    } finally {
        closeResultSet(rs);
        closeStatement(ps);
    }
}
 
開發者ID:AsuraTeam,項目名稱:asura,代碼行數:69,代碼來源:StdJDBCDelegate.java


注:本文中的org.quartz.SimpleTrigger.setMisfireInstruction方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。