Browse Source

DEC-14382 修改相关sql以及逻辑优化BI定时任务延迟现象

release/10.0
charile_Lu 4 years ago
parent
commit
2ec46c0d2a
  1. 2
      fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/DriverDelegate.java
  2. 6
      fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/JobStoreSupport.java
  3. 4
      fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/StdJDBCConstants.java
  4. 2
      fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/StdJDBCDelegate.java

2
fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/DriverDelegate.java

@ -972,7 +972,7 @@ public interface DriverDelegate {
public List<TriggerKey> selectTriggerToAcquire(Connection conn, long noLaterThan, long noEarlierThan, int maxCount)
throws SQLException;
List<TriggerKey> selectAppointTriggerToAcquire(Connection conn, long noLaterThan, long noEarlierThan, int maxCount, String appointId);
List<TriggerKey> selectAppointOrNonTriggerToAcquire(Connection conn, long noLaterThan, long noEarlierThan, int maxCount, String appointId);
/**
* <p>

6
fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/JobStoreSupport.java

@ -2835,12 +2835,10 @@ public abstract class JobStoreSupport implements JobStore, Constants {
currentLoopCount++;
try {
long misfireTime = getMisfireTime();
List<TriggerKey> waitingKeys = getDelegate().selectTriggerToAcquire(conn, noLaterThan + timeWindow, misfireTime, maxCount);
List<TriggerKey> appointKeys = getDelegate().selectAppointTriggerToAcquire(conn, noLaterThan + timeWindow, misfireTime, maxCount, this.currentId);
List<TriggerKey> appointKeys = getDelegate().selectAppointOrNonTriggerToAcquire(conn, noLaterThan + timeWindow, misfireTime, maxCount, this.currentId);
List<TriggerKey> allKeys = new ArrayList<TriggerKey>();
Set<String> keyIds = new HashSet<String>();
mergeKeys(allKeys, keyIds, waitingKeys);
mergeKeys(allKeys, keyIds, appointKeys);
// No trigger is ready to fire yet.
@ -4048,5 +4046,3 @@ public abstract class JobStoreSupport implements JobStore, Constants {
}
}
}
// EOF

4
fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/StdJDBCConstants.java

@ -541,12 +541,12 @@ public interface StdJDBCConstants extends Constants {
+ "AND (" + COL_MISFIRE_INSTRUCTION + " = -1 OR (" + COL_MISFIRE_INSTRUCTION + " != -1 AND " + COL_NEXT_FIRE_TIME + " >= ?)) "
+ "ORDER BY " + COL_NEXT_FIRE_TIME + " ASC, " + COL_PRIORITY + " DESC";
String SELECT_NEXT_APPOINT_TRIGGER_TO_ACQUIRE = "SELECT "
String SELECT_NEXT_APPOINT_OR_NON_TRIGGER_TO_ACQUIRE = "SELECT "
+ COL_TRIGGER_NAME + ", " + COL_TRIGGER_GROUP + ", "
+ COL_NEXT_FIRE_TIME + ", " + COL_PRIORITY + " FROM "
+ TABLE_PREFIX_SUBST + TABLE_TRIGGERS + " WHERE "
+ COL_SCHEDULER_NAME + " = " + SCHED_NAME_SUBST
+ " AND " + COL_APPOINT_ID + " = ?"
+ " AND (" + COL_APPOINT_ID + " = ? OR "+ COL_APPOINT_ID + " IS NULL)"
+ " AND " + COL_TRIGGER_STATE + " = ? AND " + COL_NEXT_FIRE_TIME + " <= ? "
+ "AND (" + COL_MISFIRE_INSTRUCTION + " = -1 OR (" + COL_MISFIRE_INSTRUCTION + " != -1 AND " + COL_NEXT_FIRE_TIME + " >= ?)) "
+ "ORDER BY " + COL_NEXT_FIRE_TIME + " ASC, " + COL_PRIORITY + " DESC";

2
fine-quartz/src/main/java/com/fr/third/v2/org/quartz/impl/jdbcjobstore/StdJDBCDelegate.java

@ -2661,7 +2661,7 @@ public class StdJDBCDelegate implements DriverDelegate, StdJDBCConstants {
ResultSet rs = null;
List<TriggerKey> nextTriggers = new LinkedList<TriggerKey>();
try {
ps = conn.prepareStatement(rtp(SELECT_NEXT_APPOINT_TRIGGER_TO_ACQUIRE));
ps = conn.prepareStatement(rtp(SELECT_NEXT_APPOINT_OR_NON_TRIGGER_TO_ACQUIRE));
if (maxCount < 1)
maxCount = 1;

Loading…
Cancel
Save