Exemplo n.º 1
0
        public System.Collections.Generic.List <ValueMessage> GetVaules()
        {
            System.Threading.ThreadPool.SetMaxThreads(ThreadUtil.WorkThreadNum * 2, ThreadUtil.CompletionPortNum * 2);
            int num;
            int num2;

            System.Threading.ThreadPool.GetMaxThreads(out num, out num2);
            System.DateTime createTime = System.DateTime.Now;
            System.Collections.Generic.List <ValueMessage> list             = new System.Collections.Generic.List <ValueMessage>();
            SystemThreadPool <SnmpConfiger, ValueMessage>  systemThreadPool = new SystemLargeThreadPool <SnmpConfiger, ValueMessage>(this.snmpConfigs);

            return(systemThreadPool.GetResults(delegate(System.Collections.ICollection col, object obj)
            {
                SnmpConfiger snmpConfiger = (SnmpConfiger)obj;
                SnmpExecutor snmpExecutor = new DefaultSnmpExecutor(snmpConfiger);
                ValueMessage valueMessage = null;
                try
                {
                    if (snmpConfiger.DevModelConfig.commonThresholdFlag == Constant.EatonPDU_M2)
                    {
                        valueMessage = snmpExecutor.GetValuesEatonPDU_M2();
                    }
                    else
                    {
                        if (snmpConfiger.DevModelConfig.commonThresholdFlag == Constant.APC_PDU)
                        {
                            valueMessage = snmpExecutor.GetValuesApcPDU();
                        }
                        else
                        {
                            valueMessage = snmpExecutor.GetValues();
                        }
                    }
                }
                catch (System.Exception)
                {
                }
                if (valueMessage == null)
                {
                    valueMessage = new ValueMessage();
                }
                valueMessage.CreateTime = createTime;
                valueMessage.ModelName = snmpConfiger.DevModel;
                valueMessage.IpAddress = snmpConfiger.SnmpConfig.AgentIp;
                valueMessage.PortNums = snmpConfiger.PortNumbers;
                valueMessage.PerPortReading = snmpConfiger.PerPortReading;
                valueMessage.Switchable = snmpConfiger.Switchable;
                valueMessage.SensorNums = snmpConfiger.SensorNumber;
                valueMessage.BankNums = snmpConfiger.BankNumber;
                valueMessage.DeviceID = snmpConfiger.DeviceID;
                valueMessage.DeviceMac = snmpConfiger.DeviceMac;
                lock (col)
                {
                    ((System.Collections.Generic.List <ValueMessage>)col).Add(valueMessage);
                }
            }));
        }