public bool AddJob(IJob job)
        {
            var eventArgs = new AddJobEventArgs(job);

            JobAdded?.Invoke(this, eventArgs);

            return(eventArgs.Success);
        }
Exemple #2
0
        public void EnqueueJob(Job j)
        {
            Trace.TraceInformation(string.Format("JobEnqueued in local pool: {0} {1}", j.Id, j.Title));

            QueuedJobs.AddLast(j);
            j.Status = Job.StatusEnum.QueuedLocal;

            JobAdded.Set();
        }
Exemple #3
0
 private void Apply(JobAdded @event)
 {
     _state = new JobState
     {
         Id         = new NonEmptyIdentity(Id),
         Name       = new JobName(@event.Name),
         Status     = @event.Status,
         UserId     = new NonEmptyIdentity(@event.UserId),
         WorkshopId = new NonEmptyIdentity(@event.WorkshopId),
     };
 }
Exemple #4
0
        public override void AddJob(Job job)
        {
            if (Jobs == null)
            {
                Jobs = new List <Job>();
            }
            Jobs.Add(job);

            handlersAdded.WaitOne();

            JobAdded?.Invoke((JobImpl)job, job.Status);
        }
Exemple #5
0
        private void AddJob()
        {
            var ent = _kernel.Get <IExperienceEntity>();

            ent.Employer = Employer;
            ent.Titles.Add(JobTitle);
            ent.StartDate = StartDate;
            ent.EndDate   = EndDate;

            repos.Add(ent);

            JobAdded?.Invoke(this, new EventArgs());
        }
Exemple #6
0
        public void Add(Job job)
        {
            lock (jobs) {
                lock (job) {
                    if (jobs.Contains(job) || job.HasScheduler)
                    {
                        throw new ArgumentException("Job not schedulable", "job");
                    }

                    job.HasScheduler = true;
                }

                jobs.Add(job);
                job.State     = JobState.Scheduled;
                job.Finished += OnJobFinished;

                if (CanStart(job))
                {
                    StartJob(job);
                }
            }

            JobAdded?.Invoke(job);
        }
 protected virtual void OnJobAdded(JobAddedEventArgs <CachedLog> e)
 {
     JobAdded?.Invoke(this, e);
 }
 public void push(Job job) //inserisce un nuovo job in coda, se si rende conto che la coda era precedentemente vuota risveglia il consumer
 {
     list.TryAdd(job.Id, job);
     JobAdded?.Invoke(job);
 }