[jboss-user] [JBoss jBPM] - about implementation of JobExecutorThread

swenker do-not-reply at jboss.com
Thu Apr 17 10:11:15 EDT 2008


Hi gurus:
when I read code in JobExecutorThread.I got confused about the following code snip  
  |         Collection acquiredJobs = acquireJobs();
  |   
  |           if (! acquiredJobs.isEmpty()) {
  |             Iterator iter = acquiredJobs.iterator();
  |             while (iter.hasNext() && isActive) {
  |               Job job = (Job) iter.next();
  |               executeJob(job);
  |             }
  | 
  |           } else { // no jobs acquired
  |             if (isActive) {
  |               long waitPeriod = getWaitPeriod();
  |               if (waitPeriod>0) {
  |                 synchronized(jobExecutor) {
  |                   jobExecutor.wait(waitPeriod);
  |                 }
  |               }
  |             }
  |           }
  |  
acquiredJobs are retrieved by "
      select job
      from org.jbpm.job.Job as job
      where ( (job.lockOwner is null) or (job.lockOwner = :lockOwner) )
      and job.retries > 0
      and job.dueDate <= :now
      and job.isSuspended != true
      order by job.dueDate asc"

so I dout that : is the job retrieved really is time to be executed? It's only the latest job ,not anything else.

Can you guys explains a little for me? thanks a lot 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4144869#4144869

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4144869



More information about the jboss-user mailing list