Esempio n. 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected void executeCustomStrategy(org.camunda.bpm.engine.impl.interceptor.CommandContext commandContext, org.camunda.bpm.engine.impl.persistence.entity.JobEntity job, org.camunda.bpm.engine.impl.pvm.process.ActivityImpl activity) throws Exception
        protected internal virtual void executeCustomStrategy(CommandContext commandContext, JobEntity job, ActivityImpl activity)
        {
            FailedJobRetryConfiguration retryConfiguration = getFailedJobRetryConfiguration(job, activity);

            if (retryConfiguration == null)
            {
                executeStandardStrategy(commandContext);
            }
            else
            {
                if (isFirstJobExecution(job))
                {
                    // then change default retries to the ones configured
                    initializeRetries(job, retryConfiguration.Retries);
                }
                else
                {
                    LOG.debugDecrementingRetriesForJob(job.Id);
                }

                IList <string> intervals       = retryConfiguration.RetryIntervals;
                int            intervalsCount  = intervals.Count;
                int            indexOfInterval = Math.Max(0, Math.Min(intervalsCount - 1, intervalsCount - (job.Retries - 1)));
                DurationHelper durationHelper  = getDurationHelper(intervals[indexOfInterval]);
                job.LockExpirationTime = durationHelper.DateAfter;

                logException(job);
                decrementRetries(job);
                notifyAcquisition(commandContext);
            }
        }
Esempio n. 2
0
        protected internal virtual FailedJobRetryConfiguration getFailedJobRetryConfiguration(JobEntity job, ActivityImpl activity)
        {
            FailedJobRetryConfiguration retryConfiguration = activity.Properties.get(DefaultFailedJobParseListener.FAILED_JOB_CONFIGURATION);

            while (retryConfiguration != null && retryConfiguration.Expression != null)
            {
                string retryIntervals = getFailedJobRetryTimeCycle(job, retryConfiguration.Expression);
                retryConfiguration = ParseUtil.parseRetryIntervals(retryIntervals);
            }

            return(retryConfiguration);
        }