示例#1
0
        public void Dispose()
        {
            while (_runningTaskCount > 0)
            {
                Thread.Sleep(_sleepInterval);
            }

            _setting = null;
            _queue   = null;
        }
示例#2
0
        private static void Init()
        {
            HKHTaskSection Settings = ConfigurationManager.GetSection("hkh.tasks") as HKHTaskSection;

            if (Settings != null)
            {
                for (int i = 0; i < Settings.HKHTasks.Count; i++)
                {
                    HKHTaskElement         setting    = Settings.HKHTasks[i];
                    ParallelTaskQueue      taskQueue  = Activator.CreateInstance(setting.TaskQueueType) as ParallelTaskQueue;
                    ParallelTaskDispatcher dispatcher = new ParallelTaskDispatcher(setting, taskQueue);
                    taskQueue.Dispatcher = dispatcher;

                    _pool.TryAdd(setting.TaskType.FullName, taskQueue);
                }
            }
            else
            {
                throw new ConfigurationErrorsException("hkh.tasks section was not found.");
            }
        }
示例#3
0
 public ParallelTaskDispatcher(HKHTaskElement setting, ParallelTaskQueue taskQueue)
 {
     _setting = setting;
     _queue   = taskQueue;
 }