public override void Initialize(JobProcessor thread) { base.Initialize(thread, null); UnifiedNetwork.LocationService.LookUp baseLookUp = new UnifiedNetwork.LocationService.LookUp(this); base.LookUp.BaseLookUp = baseLookUp; base.LookUp.AddLocation(new ServiceInfo { ID = 0, FullName = typeof(UnifiedNetwork.LocationService.LookUp).FullName, EndPoint = new IPEndPoint(IPAddress.Loopback, 3000) }); }
public override void Initialize(JobProcessor thread) { base.Initialize(thread, BOP.TypeConverters); UnifiedNetwork.LocationService.LookUp baseLookUp = new UnifiedNetwork.LocationService.LookUp(this); base.LookUp.BaseLookUp = baseLookUp; base.LookUp.AddLocation(new ServiceInfo { ID = 0, FullName = typeof(UnifiedNetwork.LocationService.LookUp).FullName, EndPoint = new IPEndPoint(IPAddress.Loopback, 3000) }); base.ProcessorBuilder.Add(typeof(TestOp), (Operation op) => new TestOpProcessor(this, op as TestOp)); }
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(); } }
public static void StartService(string ip, string portstr) { int port = int.Parse(portstr); IPAddress[] hostAddresses = Dns.GetHostAddresses(ip); if (hostAddresses.Length == 0) { Log <Service> .Logger.ErrorFormat("cannot find host [{0}]", ip); return; } IPAddress address = hostAddresses[new Random().Next(hostAddresses.Length - 1)]; IPEndPoint arg = new IPEndPoint(address, port); ReportService reportService = new ReportService(); JobProcessor jobProcessor = new JobProcessor(); reportService.Initialize(jobProcessor, (int)Settings.Default.ReportServiceListenPort); UnifiedNetwork.LocationService.LookUp @object = new UnifiedNetwork.LocationService.LookUp(reportService); jobProcessor.Start(); jobProcessor.Enqueue(Job.Create <IPEndPoint>(new Action <IPEndPoint>(@object.StartService), arg)); }