コード例 #1
0
 public static JobInfo FromJob(Job job)
 {            
     return new JobInfo
     {
         Created = job.Created,
         Ended = job.EndDate,
         ItemsProcessed = job.ItemsProcessed,
         RowsCreated = job.RowsCreated,
         LastException = job.LastException != null ? job.LastException.ToString() : null,
         Progress = job.Progress,
         Status = job.Status,
         StatusText = job.StatusText,
         HasResult = Directory.Exists(job.TempDirectory) && job.Status == JobStatus.Completed,
         Specification = job.Specification != null ? job.Specification.ToString() : null,
         SizeLimitExceeded = job.SizeLimitExceeded,
         Id = job.Id
     };
 }
コード例 #2
0
 public void Initialize(Job job)
 {
     Prototype.Initialize(job);
 }
コード例 #3
0
        private Job Add(IJobSpecification specification)
        {
            Job job;
            lock (_jobListSyncRoot)
            {
                var lockKey = specification.LockKey;
                List<Job> jobList = null;
                if (!string.IsNullOrEmpty(lockKey))
                {
                    jobList = GetJobList(lockKey, true);
                    if (jobList.Any(j => !j.EndDate.HasValue))
                    {
                        throw new InvalidOperationException(string.Format("Another job is running with the lock key '{0}'", lockKey));
                    }
                }

                job = new Job(specification, JobExecutionSettings);
                if (!_jobs.TryAdd(job.Id, job))
                {
                    throw new InvalidOperationException("Dupplicate job ID");
                }
                if (jobList != null)
                {
                    jobList.Add(job);
                }
            }

            PurgeOld();

            return job;
        }
コード例 #4
0
        protected virtual JobInfo GetJobInfo(Job job)
        {
            var info = JobInfo.FromJob(job);

            return info;
        }
コード例 #5
0
 private void Remove(Job job)
 {
     Job removed;
     if (_jobs.TryRemove(job.Id, out removed)
         && !string.IsNullOrEmpty(removed.Specification.LockKey))
     {
         lock (_jobListSyncRoot)
         {
             var list = GetJobList(removed.Specification.LockKey);
             if (list != null)
             {
                 list.Remove(job);
             }
         }
     }
 }
コード例 #6
0
 public void Initialize(Job job)
 {
     
 }