- Timestamp:
- 01/07/09 17:04:39 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs
r1022 r1088 18 18 public class ClientCommunicator: IClientCommunicator { 19 19 int nrOfJobs = 0; 20 Dictionary<Guid, DateTime> lastHeartbeats; 20 21 21 22 IClientAdapter clientAdapter; 22 23 IJobAdapter jobAdapter; 23 24 IJobResultsAdapter jobResultAdapter; 25 ILifecycleManager lifecycleManager; 24 26 25 27 public ClientCommunicator() { … … 27 29 jobAdapter = ServiceLocator.GetJobAdapter(); 28 30 jobResultAdapter = ServiceLocator.GetJobResultsAdapter(); 31 lifecycleManager = ServiceLocator.GetLifecycleManager(); 32 33 lifecycleManager.OnServerHeartbeat += 34 new EventHandler(lifecycleManager_OnServerHeartbeat); 29 35 30 36 for (int i = 0; i < nrOfJobs; i++) { … … 34 40 jobAdapter.Update(job); 35 41 } 42 lastHeartbeats = new Dictionary<Guid, DateTime>(); 36 43 44 } 45 46 void lifecycleManager_OnServerHeartbeat(object sender, EventArgs e) { 47 List<ClientInfo> allClients = new List<ClientInfo>(clientAdapter.GetAll()); 48 49 foreach (ClientInfo client in allClients) { 50 51 } 37 52 } 38 53 … … 58 73 public ResponseHB SendHeartBeat(HeartBeatData hbData) { 59 74 ResponseHB response = new ResponseHB(); 75 76 if (lastHeartbeats.ContainsKey(hbData.ClientId)) { 77 lastHeartbeats[hbData.ClientId] = DateTime.Now; 78 } else { 79 lastHeartbeats.Add(hbData.ClientId, DateTime.Now); 80 } 60 81 61 82 response.Success = true;
Note: See TracChangeset
for help on using the changeset viewer.