Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") protected java.util.List<org.camunda.bpm.engine.runtime.Job> reconfigureJobs(java.util.List<org.camunda.bpm.engine.runtime.Job> historyCleanupJobs, int degreeOfParallelism, int[][] minuteChunks)
        protected internal virtual IList <Job> reconfigureJobs(IList <Job> historyCleanupJobs, int degreeOfParallelism, int[][] minuteChunks)
        {
            CommandContext commandContext = Context.CommandContext;
            JobManager     jobManager     = commandContext.JobManager;

            int size = Math.Min(degreeOfParallelism, historyCleanupJobs.Count);

            for (int i = 0; i < size; i++)
            {
                JobEntity historyCleanupJob = (JobEntity)historyCleanupJobs[i];

                //apply new configuration
                HistoryCleanupContext historyCleanupContext = createCleanupContext(minuteChunks[i]);

                HISTORY_CLEANUP_JOB_DECLARATION.reconfigure(historyCleanupContext, historyCleanupJob);

                DateTime newDueDate = HISTORY_CLEANUP_JOB_DECLARATION.resolveDueDate(historyCleanupContext);

                jobManager.reschedule(historyCleanupJob, newDueDate);
            }

            int delta = degreeOfParallelism - historyCleanupJobs.Count;

            if (delta > 0)
            {
                //create new job, as there are not enough of them
                for (int i = size; i < degreeOfParallelism; i++)
                {
                    JobEntity job = createJob(minuteChunks[i]);
                    jobManager.insertAndHintJobExecutor(job);
                    historyCleanupJobs.Add(job);
                }
            }
            else if (delta < 0)
            {
                //remove jobs, if there are too much of them
                IEnumerator <Job> iterator = historyCleanupJobs.listIterator(size);
                while (iterator.MoveNext())
                {
                    JobEntity job = (JobEntity)iterator.Current;
                    jobManager.deleteJob(job);
//JAVA TO C# CONVERTER TODO TASK: .NET enumerators are read-only:
                    iterator.remove();
                }
            }

            return(historyCleanupJobs);
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") protected org.camunda.bpm.engine.impl.persistence.entity.JobEntity createJob(int[] minuteChunk)
        protected internal virtual JobEntity createJob(int[] minuteChunk)
        {
            HistoryCleanupContext historyCleanupContext = createCleanupContext(minuteChunk);

            return(HISTORY_CLEANUP_JOB_DECLARATION.createJobInstance(historyCleanupContext));
        }