cancel
Showing results for 
Search instead for 
Did you mean: 

job executor question

whdwsl
Champ in-the-making
Champ in-the-making
hi ,  it is  happy to know that: https://github.com/Activiti/Activiti/wiki/Notes-on-the-new-Actviti-Jobexecutor-(Oct-2014)


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."
4 REPLIES 4

whdwsl
Champ in-the-making
Champ in-the-making
my english is poor!!!

trademak
Star Contributor
Star Contributor
I'm sorry but what's your question? I didn't read one in your post.

Best regards,

whdwsl
Champ in-the-making
Champ in-the-making
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?

jbarrez
Star Contributor
Star Contributor
That wiki page was from an intermediate prototype, and not related to the implementation in 5.17. I'l remove the wiki (or update it to be clearer)