Ejemplo n.º 1
0
 private void WritePreds()
 {
     if (FeatureMatrix.IsEnable("ServiceReporter_ToDB"))
     {
         this.WritePredsToDB();
     }
     if (FeatureMatrix.IsEnable("ServiceReporter_ToCSV"))
     {
         this.WritePredsToCsv();
     }
 }
Ejemplo n.º 2
0
        public static bool IsEnable(string featureName)
        {
            if (featureName == null || featureName.Length == 0)
            {
                return(true);
            }
            if (featureName.IndexOf("||") >= 0)
            {
                string[] separator = new string[]
                {
                    "||"
                };
                string[] array = featureName.Split(separator, StringSplitOptions.RemoveEmptyEntries);
                if (array.Length >= 2)
                {
                    for (int i = 0; i < array.Length; i++)
                    {
                        if (FeatureMatrix.IsEnable(array[i]))
                        {
                            return(true);
                        }
                    }
                    return(false);
                }
            }
            if (featureName.IndexOf("&&") >= 0)
            {
                string[] separator2 = new string[]
                {
                    "&&"
                };
                string[] array2 = featureName.Split(separator2, StringSplitOptions.RemoveEmptyEntries);
                if (array2.Length >= 2)
                {
                    for (int j = 0; j < array2.Length; j++)
                    {
                        if (!FeatureMatrix.IsEnable(array2[j]))
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
            }
            featureName = featureName.Trim();
            if (featureName[0] == '!')
            {
                return(!FeatureMatrix.IsEnable(featureName.Substring(1)));
            }
            string @string = FeatureMatrix.GetString(featureName);

            return(@string != null && @string.Length > 0 && FeatureMatrix.CurrentVer.CompareTo(@string) >= 0);
        }
Ejemplo n.º 3
0
        public static void StartService(string ip, string portstr, Service service, bool bUsePerfLog)
        {
            int       port      = int.Parse(portstr);
            IPAddress ipaddress = null;

            foreach (IPAddress ipaddress2 in Dns.GetHostAddresses(ip))
            {
                if (ipaddress2.AddressFamily == AddressFamily.InterNetwork)
                {
                    ipaddress = ipaddress2;
                    break;
                }
            }
            if (ipaddress == null)
            {
                Log <ServiceInvoker> .Logger.ErrorFormat("cannot resolve IPv4 address for hostname [{0}]", ip);

                return;
            }
            IPEndPoint arg = new IPEndPoint(ipaddress, port);

            if (FeatureMatrix.IsEnable("FeatureMatrixSyncService"))
            {
                FeatureMatrix.OverrideFeature(EventLoader.GetStartEventList());
            }
            Type typeFromHandle = typeof(UpdateFeatureMatrix);
            Func <Operation, OperationProcessor> func = (Operation op) => new UpdateFeatureMatrixProcessor(service, op as UpdateFeatureMatrix);
            MethodInfo method = service.GetType().GetMethod("RegisterProcessor", BindingFlags.Instance | BindingFlags.NonPublic);

            method.Invoke(service, new object[]
            {
                typeFromHandle,
                func
            });
            JobProcessor jobProcessor = new JobProcessor();

            service.Initialize(jobProcessor);
            UnifiedNetwork.LocationService.LookUp @object = new UnifiedNetwork.LocationService.LookUp(service);
            jobProcessor.Start();
            service.AddBootStep();
            jobProcessor.Enqueue(Job.Create <IPEndPoint>(new Action <IPEndPoint>(@object.StartService), arg));
            if (bUsePerfLog)
            {
                PerformanceLogger performanceLogger = new PerformanceLogger(service, 300000);
                performanceLogger.Start();
            }
        }
Ejemplo n.º 4
0
        private void ReportData()
        {
            if (!this.IsInitialized)
            {
                return;
            }
            List <object[]> list = this.GetReportData().ToList <object[]>();

            if (FeatureMatrix.IsEnable("ServiceReporter_ToDB"))
            {
                this.ReportDataToDB(list);
            }
            if (FeatureMatrix.IsEnable("ServiceReporter_ToCSV"))
            {
                this.ReportDataToCsv(list);
            }
            this.RowNumber += list.Count <object[]>();
            this.LogEntries.Clear();
            foreach (ServiceReporter.SubjectEntry subjectEntry in this.Subjects)
            {
                subjectEntry.StatHistory.Clear();
            }
        }