- Timestamp:
- 01/15/09 15:56:08 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs
r1139 r1141 33 33 using HeuristicLab.Hive.JobBase; 34 34 using System.Runtime.CompilerServices; 35 using HeuristicLab.Hive.Server.Core.InternalInterfaces; 35 36 36 37 namespace HeuristicLab.Hive.Server.Core { … … 46 47 IJobResultsAdapter jobResultAdapter; 47 48 ILifecycleManager lifecycleManager; 49 IInternalJobManager jobManager; 48 50 49 51 /// <summary> … … 57 59 jobResultAdapter = ServiceLocator.GetJobResultsAdapter(); 58 60 lifecycleManager = ServiceLocator.GetLifecycleManager(); 61 jobManager = ServiceLocator.GetJobManager() as 62 IInternalJobManager; 59 63 60 64 lifecycleManager.RegisterHeartbeat( … … 90 94 foreach (Job job in allJobs) { 91 95 if (job.Client.ClientId == client.ClientId) { 92 resetJobsDependingOnResults(job);96 jobManager.ResetJobsDependingOnResults(job); 93 97 } 94 98 } … … 108 112 } 109 113 110 private void resetJobsDependingOnResults(Job job) {111 List<JobResult> allJobResults = new List<JobResult>(jobResultAdapter.GetAll());112 JobResult lastJobResult = null;113 foreach (JobResult jR in allJobResults) {114 if (jR.Job != null && jR.Job.Id == job.Id) {115 if (lastJobResult != null) {116 // if lastJobResult was before the current jobResult the lastJobResult must be updated117 if ((jR.timestamp.Subtract(lastJobResult.timestamp)).Seconds > 0)118 lastJobResult = jR;119 }120 }121 }122 if (lastJobResult != null) {123 job.Client = null;124 job.Percentage = lastJobResult.Percentage;125 job.State = State.idle;126 job.SerializedJob = lastJobResult.Result;127 } else {128 job.Client = null;129 job.Percentage = 0;130 job.State = State.idle;131 }132 jobAdapter.Update(job);133 }134 135 114 #region IClientCommunicator Members 136 115 … … 338 317 foreach (Job job in allJobs) { 339 318 if (job.Client.ClientId == client.ClientId) { 340 resetJobsDependingOnResults(job);319 jobManager.ResetJobsDependingOnResults(job); 341 320 } 342 321 }
Note: See TracChangeset
for help on using the changeset viewer.