프로젝트

일반

사용자정보

개정판 06f13e11

ID06f13e11eac2717586aacb260d0bd0f5a99e2a29
상위 6f6e7dbf
하위 0a89a17f, 880d66c2

김태성이(가) 5년 이상 전에 추가함

한글 파일명 다운로드 에러 수정
멀티 서비스 수정

Change-Id: I1a7eb48f1c758d32c805eb0394c66b92f9d27330

차이점 보기:

ConvertService/ServiceBase/Markus.Service.Station/ServiceStation.cs
27 27
        protected ILog logger = LogManager.GetLogger(typeof(ServiceStation));
28 28
        protected ServiceHost gWcfServiceHost;
29 29

  
30
        System.Timers.Timer timer;
31
        
30 32
        private int MultiProcessCount = 1;
31 33
        private string ServiceID;
32 34
        private List<SubStationServiceItem> StationServiceList;
33 35
        private List<string> StationServiceIDList;
34

  
35
        private bool IsWatch;
36
        private Service.WcfClient.StationServiceAsync.StationServiceClient StationClient;
37
        private bool IsStation;
36 38

  
37 39
        private Uri gServiceHostAddress;
38 40

  
......
46 48

  
47 49
        private int SaveStatusInterval;
48 50

  
51
        private static bool IsReleaseItems;
52

  
49 53
        private List<string> RunProjectList = new List<string>();
50 54

  
51 55
        /// <summary>
......
84 88
                    // CONVERT DATABASE 연결 문자열
85 89
                    MarkusDBConnectionString = AESEncrypter.Decrypt(config.GetValue(CONFIG_DEFINE.SERVICE, CONFIG_DEFINE.MARKUS_CONNECTION_STRING));
86 90

  
87
                    ServiceID = config.GetValue(CONFIG_DEFINE.SERVICE, CONFIG_DEFINE.SERVICE_ID, Guid.Empty.ToString());
91
                    IsStation = System.Convert.ToBoolean(config.GetValue(CONFIG_DEFINE.SERVICE, CONFIG_DEFINE.IS_STATAION, "false"));
88 92

  
89
                    var servicetList = config.GetValue(CONFIG_DEFINE.SERVICE, CONFIG_DEFINE.SERVICE_LIST, "");
93
                    ServiceID = config.GetValue(CONFIG_DEFINE.SERVICE, CONFIG_DEFINE.SERVICE_ID, Guid.Empty.ToString());
90 94

  
91
                    if (!servicetList.IsNullOrEmpty())
95
                    if (IsStation)
92 96
                    {
93
                        StationServiceIDList = servicetList.Split(',').ToList();
94
                    }
97
                        var servicetList = config.GetValue(CONFIG_DEFINE.SERVICE, CONFIG_DEFINE.SERVICE_LIST, "");
95 98

  
96
                    IsWatch = System.Convert.ToBoolean(config.GetValue(CONFIG_DEFINE.SERVICE, CONFIG_DEFINE.IS_WATCH, "false"));
99
                        if (!servicetList.IsNullOrEmpty())
100
                        {
101
                            StationServiceIDList = servicetList.Split(',').ToList();
102
                        }
103
                    }
104
                    else
105
                    {
106
                        var address = config.GetValue(CONFIG_DEFINE.SERVICE, CONFIG_DEFINE.STATAION_ADDRESS,"");
97 107

  
108
                        if (!address.IsNullOrEmpty())
109
                        {
110
                            BasicHttpBinding myBinding = new BasicHttpBinding();
111
                            EndpointAddress myEndpoint = new EndpointAddress(UriHelper.UriCreate(address));
112
                            StationClient = new WcfClient.StationServiceAsync.StationServiceClient(myBinding, myEndpoint);
113
                        }
114
                    }
98 115
                    
99 116
                    MultiProcessCount = System.Convert.ToInt16(config.GetValue(CONFIG_DEFINE.SERVICE, CONFIG_DEFINE.CONVERT_SERVICE_PROCESS,"5"));
100 117

  
......
155 172
        {
156 173
            timer.Stop();
157 174

  
158
            //var process = Process.GetProcessesByName("Markus.Service.ConvertProcess");
175
            if (!IsReleaseItems)
176
            {
177
                ReleaseItems();
178
            }
159 179

  
160
            //for (int i = 0; i < process.Count(); i++)
161
            //{
162
            //    System.Diagnostics.Debug.WriteLine($"Command [{i}]: " , string.Join(" ", process[i].Arguments().CommandLine));
163
            //}
180
            System.Threading.Thread.SpinWait(10000);
164 181

  
165
            //for (int i = 0; i < ServiceStation.AliveConvertQueue.Count; i++)
166
            //{
167
            //    System.Diagnostics.Debug.WriteLine($"AliveConvertItems  [{i}]: ", ServiceStation.AliveConvertQueue[i].ConvertID);
168
            //}
182
            timer.Start();
183
        }
184

  
185
        /// <summary>
186
        /// alivequeue와 process를 비교하여 정리하고
187
        /// 대기중인 아이템을 분배한다.
188
        /// </summary>
189
        private void ReleaseItems()
190
        {
169 191
            try
170 192
            {
171
                CleanUpItems();
172
                setDataBaseWaitingList();
193
                IsReleaseItems = true;
194

  
195
                CleanUpAliveQueueItems();
196

  
197
                if (IsStation)
198
                {
199
                    System.Diagnostics.Debug.WriteLine("ReflashSubService");
200
                    ReflashSubService();
201
                    System.Diagnostics.Debug.WriteLine("ReflashSubService");
202

  
203
                    System.Diagnostics.Debug.WriteLine("CleanUpDataBaseItems");
204
                    CleanUpDataBaseItems();
205
                    System.Diagnostics.Debug.WriteLine("setDataBaseWaitingList");
206
                    setDataBaseWaitingList();
207
                    System.Diagnostics.Debug.WriteLine("ReleaseItems end");
208
                }
173 209
            }
174 210
            catch (Exception ex)
175 211
            {
176 212
                logger.Error("get Wating Item error", ex);
177 213
            }
178 214

  
179
            System.Threading.Thread.SpinWait(10000);
180
            timer.Start();
215
            IsReleaseItems = false;
181 216
        }
182 217

  
183
        System.Timers.Timer timer;
184

  
185 218
        /// <summary>
186 219
        /// System.Diagnostics.Process의 ProcessorAffinity Core 선호도를 위한 초기화
187 220
        /// 설정된 MultiProcessCount에 대해서 프로세스의 코어의 선호도를 지정 한다.
......
275 308
                }
276 309

  
277 310
                //  각 서비스에 컨버터 아이템을 보내기 위한 서비스 초기화
278
                if (IsWatch)
311
                if (IsStation)
279 312
                {
280 313
                    SetServiceList(this.StationServiceIDList);
281 314
                }
......
301 334

  
302 335
            logger.Info("Start ServiceStation");
303 336

  
304
            if (IsWatch)
305
            {
306
                logger.Info("ServiceStation Wacth Convert Items");
307
          
308
                timer = new System.Timers.Timer(1000);
309
                timer.Elapsed += Timer_Elapsed;
310
                timer.AutoReset = true;
311
                timer.Start();
312
            }
337
            timer = new System.Timers.Timer(1000);// new TimeSpan(0,0,0,10).TotalMilliseconds);
338
            timer.Elapsed += Timer_Elapsed;
339
            timer.AutoReset = true;
340
            timer.Start();
313 341

  
314 342
            return true;
315 343
        }
......
330 358
                        {
331 359
                            BasicHttpBinding myBinding = new BasicHttpBinding();
332 360
                            EndpointAddress myEndpoint = new EndpointAddress(UriHelper.UriCreate(prop.SERVICE_ADDRESS));
333
                            var StationServiceClient = new StationService.StationServiceClient(myBinding, myEndpoint);
361
                            var StationServiceClient = new WcfClient.StationServiceAsync.StationServiceClient(myBinding, myEndpoint);
334 362
                        
335 363
                       
336 364
                                //var items = StationServiceClient.AliveConvertList();
......
345 373
                    }
346 374
                    catch (Exception ex)
347 375
                    {
348
                        logger.Error($"Service Properties Error  ID : { item }");
376
                        logger.Error($"Service Properties Error  ID : { item }",ex);
349 377
                    }
350 378
                }
351 379
            }
......
355 383
        {
356 384
            try
357 385
            {
386
                timer.Stop();
358 387
                StopWcfService();
359 388
                Stopprocess();
360 389

  

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)