public void AddProcessingGroup(string name, ProcessingGroupInfo info)
 {
     if (!m_ProcessingGroupInfos.TryAdd(name, info))
     {
         throw new InvalidOperationException($"Can not add processing group '{name}'. It already exists.");
     }
 }
Example #2
0
        public ProcessingGroup(string name, ProcessingGroupInfo processingGroupInfo)
        {
            Name = name;
            m_ConcurrencyLevel = Math.Max(processingGroupInfo.ConcurrencyLevel, 0);

            m_SchedulingStrategy = (m_ConcurrencyLevel == 0)
                ? (ISchedulingStrategy) new CurrentThreadSchedulingStrategy()
                : (ISchedulingStrategy) new QueuedSchedulingStrategy(m_ConcurrencyLevel, processingGroupInfo.QueueCapacity, $"ProcessingGroup '{Name}' thread");
        }
        public bool GetProcessingGroupInfo(string name, out ProcessingGroupInfo groupInfo)
        {
            if (m_ProcessingGroupInfos.TryGetValue(name, out var info))
            {
                groupInfo = new ProcessingGroupInfo(info);
                return(true);
            }

            groupInfo = null;
            return(false);
        }
        public void AddProcessingGroup(string name, ProcessingGroupInfo info)
        {
            lock (m_ProcessingGroups)
            {
                if (m_ProcessingGroups.ContainsKey(name))
                {
                    throw new InvalidOperationException($"Can not add processing group '{name}'. It already exists.");
                }

                m_ProcessingGroupInfos.Add(name, info);
            }
        }
        private ProcessingGroup GetProcessingGroup(string processingGroup)
        {
            ProcessingGroup @group;

            lock (m_ProcessingGroups)
            {
                if (m_ProcessingGroups.TryGetValue(processingGroup, out @group))
                {
                    return(@group);
                }

                ProcessingGroupInfo info;
                if (!m_ProcessingGroupInfos.TryGetValue(processingGroup, out info))
                {
                    info = new ProcessingGroupInfo();
                    m_ProcessingGroupInfos.Add(processingGroup, info);
                }
                @group = new ProcessingGroup(processingGroup, info);
                m_ProcessingGroups.Add(processingGroup, @group);
            }
            return(@group);
        }
Example #6
0
 public bool GetProcessingGroupInfo(string name, out ProcessingGroupInfo groupInfo)
 {
     return(m_ProcessingGroupManager.GetProcessingGroupInfo(name, out groupInfo));
 }
Example #7
0
 public void AddProcessingGroup(string name, ProcessingGroupInfo info)
 {
     m_ProcessingGroupManager.AddProcessingGroup(name, info);
 }