示例#1
0
        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);
        }
示例#2
0
        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);
            }
        }
示例#3
0
 public virtual void AcquiredJobs(string processEngine, AcquiredJobs acquiredJobs)
 {
     LogDebug("022", "Acquired {0} jobs for process engine '{1}': {2}", acquiredJobs.Size(), processEngine, acquiredJobs.JobIdBatches);
 }
示例#4
0
 public virtual void SubmitAcquiredJobs(string engineName, AcquiredJobs acquiredJobs)
 {
     AcquiredJobsByEngine[engineName] = acquiredJobs;
 }