示例#1
0
        public virtual void Dispose()
        {
            this.OnStop();

            this.Dispatcher.Dispose();
            this.Dispatcher = 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.");
            }
        }