Пример #1
0
        public virtual void run()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final JobExecutorContext jobExecutorContext = new JobExecutorContext();
            JobExecutorContext jobExecutorContext = new JobExecutorContext();

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.List<String> currentProcessorJobQueue = jobExecutorContext.getCurrentProcessorJobQueue();
            IList <string>  currentProcessorJobQueue = jobExecutorContext.CurrentProcessorJobQueue;
            CommandExecutor commandExecutor          = processEngine.ProcessEngineConfiguration.CommandExecutorTxRequired;

            ((IList <string>)currentProcessorJobQueue).AddRange(jobIds);

            Context.JobExecutorContext = jobExecutorContext;
            try
            {
                while (currentProcessorJobQueue.Count > 0)
                {
                    string nextJobId = currentProcessorJobQueue.RemoveAt(0);
                    if (jobExecutor.Active)
                    {
                        try
                        {
                            executeJob(nextJobId, commandExecutor);
                        }
                        catch (Exception t)
                        {
                            LOG.exceptionWhileExecutingJob(nextJobId, t);
                        }
                    }
                    else
                    {
                        try
                        {
                            unlockJob(nextJobId, commandExecutor);
                        }
                        catch (Exception t)
                        {
                            LOG.exceptionWhileUnlockingJob(nextJobId, t);
                        }
                    }
                }

                // if there were only exclusive jobs then the job executor
                // does a backoff. In order to avoid too much waiting time
                // we need to tell him to check once more if there were any jobs added.
                jobExecutor.jobWasAdded();
            }
            finally
            {
                Context.removeJobExecutorContext();
            }
        }
Пример #2
0
 public ExclusiveJobAddedNotification(string jobId, JobExecutorContext jobExecutorContext)
 {
     this.jobId = jobId;
     this.jobExecutorContext = jobExecutorContext;
 }