示例#1
0
        protected virtual JobsContext GetJobsContext()
        {
            var context = new JobsContext();

            SetContextParams(context);
            return(context);
        }
示例#2
0
        public Job(JobsContext jobsContext, params Job[] parents)
        {
            this.jobsContext = jobsContext;
            this.parents     = parents;

            foreach (var parent in parents)
            {
                parent.AddChild(this);
            }
        }
示例#3
0
        protected virtual void SetContextParams(JobsContext context)
        {
            if (settings.MaxActionsInParallel > 1)
            {
                context.ActionSemaphore    = new SemaphoreSlim(settings.MaxActionsInParallel, settings.MaxActionsInParallel);
                context.UseActionSemaphore = true;
            }

            if (settings.MaxBackwardActionsInParallel > 1)
            {
                context.BackActionSemaphore    = new SemaphoreSlim(settings.MaxBackwardActionsInParallel, settings.MaxBackwardActionsInParallel);
                context.UseBackActionSemaphore = true;
            }
        }