protected virtual AcquiredJobs AcquireJobs(JobAcquisitionContext context, IJobAcquisitionStrategy acquisitionStrategy, ProcessEngineImpl currentProcessEngine) { ICommandExecutor commandExecutor = ((ProcessEngineConfigurationImpl)currentProcessEngine.ProcessEngineConfiguration).CommandExecutorTxRequired; var numJobsToAcquire = acquisitionStrategy.GetNumJobsToAcquire(currentProcessEngine.Name); AcquiredJobs acquiredJobs = null; if (numJobsToAcquire > 0) { JobExecutor.LogAcquisitionAttempt(currentProcessEngine); acquiredJobs = commandExecutor.Execute(JobExecutor.GetAcquireJobsCmd(numJobsToAcquire)); } else { acquiredJobs = new AcquiredJobs(numJobsToAcquire); } context.SubmitAcquiredJobs(currentProcessEngine.Name, acquiredJobs); JobExecutor.LogAcquiredJobs(currentProcessEngine, acquiredJobs.Size()); JobExecutor.LogAcquisitionFailureJobs(currentProcessEngine, acquiredJobs.NumberOfJobsFailedToLock); Log.AcquiredJobs(currentProcessEngine.Name, acquiredJobs); return(acquiredJobs); }
protected internal virtual void ExecuteJobs(JobAcquisitionContext context, ProcessEngineImpl currentProcessEngine, AcquiredJobs acquiredJobs) { // submit those jobs that were acquired in previous cycles but could not be scheduled for execution var additionalJobs = context.AdditionalJobBatchesByEngine.GetValueOrNull(currentProcessEngine.Name); if (additionalJobs != null) { foreach (var jobBatch in additionalJobs) { Log.ExecuteJobs(currentProcessEngine.Name, jobBatch); JobExecutor.ExecuteJobs(jobBatch, currentProcessEngine); } } // submit those jobs that were acquired in the current cycle foreach (var jobIds in acquiredJobs.JobIdBatches) { Log.ExecuteJobs(currentProcessEngine.Name, jobIds); JobExecutor.ExecuteJobs(jobIds, currentProcessEngine); } }
public virtual void AcquiredJobs(string processEngine, AcquiredJobs acquiredJobs) { LogDebug("022", "Acquired {0} jobs for process engine '{1}': {2}", acquiredJobs.Size(), processEngine, acquiredJobs.JobIdBatches); }
public virtual void SubmitAcquiredJobs(string engineName, AcquiredJobs acquiredJobs) { AcquiredJobsByEngine[engineName] = acquiredJobs; }