Exemplo n.º 1
0
        /// <summary>
        /// 向处理集群推送处理数据
        /// </summary>
        /// <param name="pitem"></param>
        public void PushCluster(TaskID <TIn> pitem)
        {
            Init();

            var min_saturation = MinCountTower();// 最小饱和

            min_saturation.PushProcess(pitem);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 向容器内推送任务数据,数据带有任务id
 /// </summary>
 /// <param name="task"></param>
 /// <returns></returns>
 public BaseDiverter <T> PushTask(TaskID <T> task)
 {
     // 无传入数据不处理
     if (task == null)
     {
         return(this);
     }
     // 先检查分流容器是否空,空则创建
     if (TaskDiverter == null)
     {
         TaskDiverter = new ConcurrentQueue <TaskID <T> >();
     }
     //
     TaskDiverter.Enqueue(task);
     Interlocked.Increment(ref this.diverterCount);
     return(this);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 向容器内推送任务数据
        /// </summary>
        /// <param name="task"></param>
        /// <returns></returns>
        public BaseDiverter <T> PushTask(T task)
        {
            // 无传入数据不处理
            if (task == null)
            {
                return(this);
            }
            // 先检查分流容器是否空,空则创建
            if (TaskDiverter == null)
            {
                TaskDiverter = new ConcurrentQueue <TaskID <T> >();
            }
            // 创建新任务
            var new_task = new TaskID <T>()
            {
                TaskPID = 0, TaskData = task
            };

            TaskDiverter.Enqueue(new_task);
            Interlocked.Increment(ref this.diverterCount);
            return(this);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 输出分流具体处理
 /// </summary>
 public override void Distribute()
 {
     Task.Run(() =>
     {
         while (stop == false)
         {
             if (this.DiverterCount <= 0)
             {
                 loopDelay = 2000;
             }
             else
             {
                 loopDelay = 20;
             }
             TaskID <TOut> out_data = PullTask();
             if (out_data != null)
             {
                 PullProcess(out_data);
             }
             Task.Delay(loopDelay);
         }
     });
 }
Exemplo n.º 5
0
 /// <summary>
 /// 推送处理数据
 /// </summary>
 /// <param name="task"></param>
 /// <returns></returns>
 public long PushProcess(TaskID <TIn> task)
 {
     Init();
     InList.Enqueue(task);
     return(Add1Count());
 }