DESC:
When expire the lock , mongo has a exception (such as connection time out) . Then the lock cannot be expired. And this job will no longer be triggered.
REASON:
the code in ExpiryCalculator.class
`
public boolean isTriggerLockExpired(Document lock) {
String schedulerId = lock.getString(Constants.LOCK_INSTANCE_ID);
return isLockExpired(lock, triggerTimeoutMillis) && hasDefunctScheduler(schedulerId);
}
private boolean hasDefunctScheduler(String schedulerId) {
Scheduler scheduler = schedulerDao.findInstance(schedulerId);
if (scheduler == null) {
log.debug("No such scheduler: {}", schedulerId);
return false;
}
return scheduler.isDefunct(clock.millis()) && schedulerDao.isNotSelf(scheduler);
}
If scheduler is not defunct ,the function (isTriggerLockExpired())s result will always be false. And the job which was locked will nerver be triggered.
DESC: When expire the lock , mongo has a exception (such as connection time out) . Then the lock cannot be expired. And this job will no longer be triggered. REASON: the code in ExpiryCalculator.class ` public boolean isTriggerLockExpired(Document lock) { String schedulerId = lock.getString(Constants.LOCK_INSTANCE_ID); return isLockExpired(lock, triggerTimeoutMillis) && hasDefunctScheduler(schedulerId); }
private boolean hasDefunctScheduler(String schedulerId) { Scheduler scheduler = schedulerDao.findInstance(schedulerId); if (scheduler == null) { log.debug("No such scheduler: {}", schedulerId); return false; } return scheduler.isDefunct(clock.millis()) && schedulerDao.isNotSelf(scheduler); }
If scheduler is not defunct ,the function (isTriggerLockExpired())
s result will always be false. And the job which was locked will nerver be triggered.