Skip to content

Commit

Permalink
[Fix](JobManager)Release the lock immediately after modifying job met…
Browse files Browse the repository at this point in the history
…adata to avoid holding the lock for an extended period.
  • Loading branch information
CalvinKirs committed Jul 19, 2024
1 parent fceebf6 commit 1ab1d57
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,19 @@ public void registerJob(T job) throws JobException {
throw new JobException("job id exist, jobId:" + job.getJobId());
}
jobMap.put(job.getJobId(), job);
//check its need to scheduler
jobScheduler.scheduleOneJob(job);
job.logCreateOperation();
} finally {
writeUnlock();
}
try {
//check its need to scheduler
jobScheduler.scheduleOneJob(job);
} catch (Exception e) {
// if scheduler job error, we need to unregister job
log.warn("first schedule job error,unregister job, jobName:" + job.getJobName());
unregisterJob(job.getJobId());
throw new JobException("register job error, jobName:" + job.getJobName());
}
}

private void checkJobNameExist(String jobName) throws JobException {
Expand Down

0 comments on commit 1ab1d57

Please sign in to comment.