public override void HandleTask(TaskArgs e) { //Console.WriteLine("Task is handled to {0} to load tids", this.GetType().Name); Logger.Logger.Get(this).Message(string.Format("Task is handled to {0} to load tids", this.GetType().Name)); e.Tids = new List<int> { ++tidCount, ++tidCount, ++tidCount }; Console.WriteLine("{0} loaded the following tids{1}", this.GetType().Name, e.Tids.ConvertAll<string>((t) => t.ToString()).Aggregate((i, j) => i + "," + j)); if (Succesor != null) { Succesor.Handle(e); } }
public override void HandleTask(TaskArgs e) { Console.WriteLine("Task is handled to {0} to parallelize the queueing for tids:{1}", this.GetType().Name, e.Tids.ConvertAll<string>((t) => t.ToString()).Aggregate((i, j) => i + "," + j)); e.Tids.ForEach((t) => Tasks.Add(new System.Threading.Tasks.Task(() => new Task(WorkerType.Type1, t).PerformTask()))); Console.WriteLine("{0} parallelized the queueing for tids:{1}", this.GetType().Name, e.Tids.ConvertAll<string>((t) => t.ToString()).Aggregate((i, j) => i + "," + j)); this.Tasks.ForEach((t) => t.Start()); //System.Threading.Tasks.Task.Factory.ContinueWhenAll(this.Tasks.ToArray(),); if (Succesor != null) { Succesor.Handle(e); } }
public abstract void HandleTask(TaskArgs e);
public virtual void Handle(TaskArgs e) { _handler?.Invoke(e); }