Пример #1
0
        public System.Collections.Generic.List <ThresholdMessage> GetThresholds()
        {
            this.retryconfigs.Clear();
            System.DateTime createTime = System.DateTime.Now;
            System.Collections.Generic.List <ThresholdMessage> list             = new System.Collections.Generic.List <ThresholdMessage>();
            SystemThreadPool <SnmpConfiger, ThresholdMessage>  systemThreadPool = new SystemLargeThreadPool <SnmpConfiger, ThresholdMessage>(this.snmpConfigs);

            return(systemThreadPool.GetResults(delegate(System.Collections.ICollection col, object obj)
            {
                SnmpConfiger snmpConfiger = (SnmpConfiger)obj;
                SnmpExecutor snmpExecutor = new DefaultSnmpExecutor(snmpConfiger);
                ThresholdMessage thresholdMessage = null;
                try
                {
                    if (snmpConfiger.DevModelConfig.commonThresholdFlag == Constant.EatonPDU_M2)
                    {
                        thresholdMessage = snmpExecutor.GetThresholdsEatonPDU_M2();
                    }
                    else
                    {
                        if (snmpConfiger.DevModelConfig.commonThresholdFlag == Constant.APC_PDU)
                        {
                            thresholdMessage = snmpExecutor.GetThresholdsApcPDU();
                        }
                        else
                        {
                            thresholdMessage = snmpExecutor.GetThresholds();
                        }
                    }
                    thresholdMessage.CreateTime = createTime;
                    thresholdMessage.IpAddress = snmpConfiger.SnmpConfig.AgentIp;
                    thresholdMessage.PortNums = snmpConfiger.PortNumbers;
                    thresholdMessage.PerPortReading = snmpConfiger.PerPortReading;
                    thresholdMessage.Switchable = snmpConfiger.Switchable;
                    thresholdMessage.SensorNums = snmpConfiger.SensorNumber;
                    thresholdMessage.BankNums = snmpConfiger.BankNumber;
                    thresholdMessage.DeviceID = snmpConfiger.DeviceID;
                    thresholdMessage.DeviceMac = snmpConfiger.DeviceMac;
                }
                catch (System.Exception)
                {
                }
                if (thresholdMessage != null)
                {
                    lock (col)
                    {
                        ((System.Collections.Generic.List <ThresholdMessage>)col).Add(thresholdMessage);
                        return;
                    }
                }
                this.retryconfigs.Add(snmpConfiger);
            }));
        }