but in AcquireAsyncJobsDueCmd.class(5.17.0) i found code like this:
public AcquiredJobEntities execute(CommandContext commandContext) { AcquiredJobEntities acquiredJobs = new AcquiredJobEntities(); List<JobEntity> jobs = commandContext .getJobEntityManager() .findAsyncJobsDueToExecute(new Page(0, asyncExecutor.getMaxAsyncJobsDuePerAcquisition())); for (JobEntity job: jobs) { lockJob(commandContext, job, asyncExecutor.getAsyncJobLockTimeInMillis()); acquiredJobs.addJob(job); asyncExecutor.executeAsyncJob(job); } return acquiredJobs; }
where is : "Try to write the unique UUID of the job executor into as many job rows (big difference with original) as possible (UPDATE JOB set LOCK_OWNER_ = 'xxx' where LOCK_OWNER_ = null'). This is called 'acquiring' in the code. If nothing found, thread sleeps for a configurable amount of time."
sorry, the question is : i think the code is not as the description is. the description is : Try to write the unique UUID of the job executor into as many job rows (big difference with original) as possible (UPDATE JOB set LOCK_OWNER_ = 'xxx' where LOCK_OWNER_ = null')
but the code is still query first and then lock them, it is same with original.
the new solution shoul be update first and then query , execute them last. am i right?