23 using System.Collections.Generic;
29 namespace Ntp.Common.Process
36 IEnumerable<IRequest> peers,
39 this.scheduler = scheduler;
43 waitHandle =
new EventWaitHandle(
false, EventResetMode.AutoReset);
53 private readonly IEnumerable<IRequest>
peers;
60 bool activated =
true;
61 if (peers.Count() != 0)
69 bool otherActive =
false;
70 foreach (var request
in peers)
74 string answer = request.Send(
"ping");
76 if (answer != null && answer ==
"*" && activated)
78 log.ClusterNodeAlive(request);
80 else if (answer != null && answer ==
"active" && activated)
82 log.ClusterNodeActive(request);
86 log.ClusterNodeDead(request);
89 if (answer != null && answer ==
"active")
96 log.ClusterNodeError(request, e);
104 scheduler.RunOneCycle();
114 waitHandle.WaitOne(10000);
124 #region IDisposable Support 135 waitHandle.Dispose();
138 disposedValue =
true;
149 GC.SuppressFinalize(
this);
void Dispose(bool disposing)
A scheduler performs scheduling of jobs according to job schedule descriptions.
EventHandler< EventArgs > ExitApplication
EventWaitHandle WaitHandle
Gets the wait handle of this Scheduler.
readonly EventWaitHandle waitHandle
readonly Scheduler scheduler
Cluster(Scheduler scheduler, IApplicationController controller, IEnumerable< IRequest > peers, LogBase log)
readonly IEnumerable< IRequest > peers