本文整理汇总了Java中org.quartz.SimpleTrigger.setPriority方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleTrigger.setPriority方法的具体用法?Java SimpleTrigger.setPriority怎么用?Java SimpleTrigger.setPriority使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.quartz.SimpleTrigger
的用法示例。
在下文中一共展示了SimpleTrigger.setPriority方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}