개정판 1ae729e4
contoller Richtextbox 추가
서비스 안정화
Change-Id: I1a18f9d1f9b0aaed92d4e22df779b46c4e8958e0
ConvertService/ServiceBase/Markus.Service.Station/ServiceStation.cs | ||
---|---|---|
15 | 15 |
using System.Linq; |
16 | 16 |
using System.Runtime.InteropServices; |
17 | 17 |
using System.ServiceModel; |
18 |
using System.ServiceModel.Channels; |
|
19 |
using System.ServiceModel.Dispatcher; |
|
18 | 20 |
using System.ServiceProcess; |
19 | 21 |
using System.Text; |
20 | 22 |
using System.Threading.Tasks; |
... | ... | |
175 | 177 |
private void Timer_Elapsed(object sender, ElapsedEventArgs e) |
176 | 178 |
{ |
177 | 179 |
|
178 |
System.Diagnostics.Debug.WriteLine("timer : " + e?.SignalTime); |
|
179 |
try |
|
180 |
{ |
|
181 |
if (!IsReleaseItems) |
|
182 |
{ |
|
183 |
ReleaseItems(); |
|
184 |
} |
|
185 |
|
|
186 |
if ((DateTime.Now - logTime) >= new TimeSpan(0, 5, 0)) |
|
187 |
{ |
|
188 |
logTime = DateTime.Now; |
|
189 |
logger.Info("StationService Alive Check"); |
|
190 |
} |
|
191 |
} |
|
192 |
catch (Exception ex) |
|
193 |
{ |
|
194 |
logger.Error("Timer Error " ,ex); |
|
195 |
} |
|
180 |
//System.Diagnostics.Debug.WriteLine("timer : " + e?.SignalTime);
|
|
181 |
//try
|
|
182 |
//{
|
|
183 |
// if (!IsReleaseItems)
|
|
184 |
// {
|
|
185 |
// ReleaseItems();
|
|
186 |
// }
|
|
187 |
|
|
188 |
// if ((DateTime.Now - logTime) >= new TimeSpan(0, 5, 0))
|
|
189 |
// {
|
|
190 |
// logTime = DateTime.Now;
|
|
191 |
// logger.Info("StationService Alive Check");
|
|
192 |
// }
|
|
193 |
//}
|
|
194 |
//catch (Exception ex)
|
|
195 |
//{
|
|
196 |
// logger.Error("Timer Error " ,ex);
|
|
197 |
//}
|
|
196 | 198 |
|
197 |
System.Threading.Thread.SpinWait(1000); |
|
199 |
//System.Threading.Thread.SpinWait(1000);
|
|
198 | 200 |
|
199 |
timer.Start(); |
|
201 |
//timer.Start();
|
|
200 | 202 |
} |
201 | 203 |
|
202 | 204 |
/// <summary> |
... | ... | |
215 | 217 |
{ |
216 | 218 |
//if (IsDataBaseWaitingList(1)) |
217 | 219 |
//{ |
218 |
System.Diagnostics.Debug.WriteLine("ReleaseItems start"); |
|
219 |
ReflashSubServiceAsync(); |
|
220 |
System.Diagnostics.Debug.WriteLine("ReleaseItems start"); |
|
221 |
ReflashSubServiceAsync(); |
|
222 |
|
|
223 |
if (StationServiceList.All(x => x.IsOnline)) |
|
224 |
{ |
|
220 | 225 |
CleanUpDataBaseItems(); |
221 | 226 |
setDataBaseWaitingList(); |
222 |
System.Diagnostics.Debug.WriteLine("ReleaseItems end"); |
|
227 |
} |
|
228 |
else |
|
229 |
{ |
|
230 |
System.Diagnostics.Debug.WriteLine("Service Any Offline"); |
|
231 |
} |
|
232 |
|
|
233 |
System.Diagnostics.Debug.WriteLine("ReleaseItems end"); |
|
223 | 234 |
//} |
224 | 235 |
} |
225 | 236 |
} |
... | ... | |
359 | 370 |
logger.Info("Start ServiceStation"); |
360 | 371 |
var autoEvent = new System.Threading.AutoResetEvent(false); |
361 | 372 |
|
362 |
stateTimer = new System.Threading.Timer(new System.Threading.TimerCallback(TimerCallBack), null, 0, 10000);
|
|
373 |
stateTimer = new System.Threading.Timer(new System.Threading.TimerCallback(TimerCallBack), null, 0, 500);
|
|
363 | 374 |
//timer = new System.Timers.Timer(new TimeSpan(0, 0, 0, 10).TotalMilliseconds); |
364 | 375 |
//timer.Elapsed += Timer_Elapsed; |
365 | 376 |
//timer.AutoReset = true; |
... | ... | |
370 | 381 |
|
371 | 382 |
System.Threading.Timer stateTimer; |
372 | 383 |
DateTime logTime; |
384 |
DateTime ReleaseTime; |
|
373 | 385 |
|
374 | 386 |
private void TimerCallBack(object state) |
375 | 387 |
{ |
... | ... | |
377 | 389 |
//stateTimer.Change(-1, -1); |
378 | 390 |
try |
379 | 391 |
{ |
380 |
if (!IsReleaseItems) |
|
392 |
|
|
393 |
if ((DateTime.Now - ReleaseTime) >= new TimeSpan(0, 0,15)) |
|
381 | 394 |
{ |
382 |
ReleaseItems(); |
|
395 |
if (!IsReleaseItems) |
|
396 |
{ |
|
397 |
ReleaseItems(); |
|
398 |
} |
|
399 |
ReleaseTime = DateTime.Now; |
|
383 | 400 |
} |
401 |
|
|
384 | 402 |
|
385 | 403 |
if ((DateTime.Now - logTime) >= new TimeSpan(0, 5, 0)) |
386 | 404 |
{ |
... | ... | |
388 | 406 |
logger.Info("StationService Alive Check"); |
389 | 407 |
} |
390 | 408 |
|
409 |
|
|
391 | 410 |
} |
392 | 411 |
catch (Exception ex) |
393 | 412 |
{ |
394 | 413 |
logger.Error("Timer Error ", ex); |
395 | 414 |
} |
396 |
System.Threading.Thread.SpinWait(100000); |
|
397 |
stateTimer.Change(0, 10000); |
|
415 |
|
|
416 |
///System.Threading.Thread.SpinWait(100000); |
|
417 |
//stateTimer.Change(0, 10000); |
|
398 | 418 |
} |
399 | 419 |
|
400 | 420 |
public void SetServiceList(List<string> serviceList) |
... | ... | |
411 | 431 |
|
412 | 432 |
if (prop != null) |
413 | 433 |
{ |
414 |
BasicHttpBinding myBinding = new BasicHttpBinding(); |
|
434 |
BasicHttpBinding httpbinding = new BasicHttpBinding(); |
|
435 |
httpbinding.CloseTimeout = new TimeSpan(0, 10, 0); |
|
436 |
httpbinding.ReceiveTimeout = new TimeSpan(0, 10, 0); |
|
437 |
httpbinding.SendTimeout = new TimeSpan(0, 10, 0); |
|
438 |
httpbinding.OpenTimeout = new TimeSpan(0, 10, 0); |
|
439 |
|
|
415 | 440 |
EndpointAddress myEndpoint = new EndpointAddress(UriHelper.UriCreate(prop.SERVICE_ADDRESS)); |
416 |
var StationServiceClient = new WcfClient.StationServiceTask.StationServiceClient(myBinding, myEndpoint);
|
|
441 |
var StationServiceClient = new WcfClient.StationServiceTask.StationServiceClient(httpbinding, myEndpoint);
|
|
417 | 442 |
|
418 | 443 |
|
419 | 444 |
//var items = StationServiceClient.AliveConvertList(); |
... | ... | |
438 | 463 |
{ |
439 | 464 |
try |
440 | 465 |
{ |
441 |
timer.Stop(); |
|
466 |
if (timer != null) |
|
467 |
{ |
|
468 |
timer.Stop(); |
|
469 |
} |
|
470 |
|
|
442 | 471 |
StopWcfService(); |
443 | 472 |
Stopprocess(); |
444 | 473 |
|
내보내기 Unified diff