Changeset 6202
- Timestamp:
- 05/16/11 16:10:10 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs
r6178 r6202 443 443 444 444 private static object startInAppDomainLocker = new object(); 445 445 private static Mutex startInAppDomainMutex = new Mutex(); 446 446 /// <summary> 447 447 /// A new Job from the wcfService has been received and will be started within a AppDomain. … … 451 451 clientCom.StatusChanged(ConfigManager.Instance.GetStatusForClientConsole()); 452 452 453 lock (startInAppDomainLocker) { 453 startInAppDomainMutex.WaitOne(); // mutex is used instead of lock to be able to release it before executor.Start() is called (which may take long time) 454 bool released = false; 455 454 456 if (executors.ContainsKey(job.Id)) { 455 457 clientCom.LogMessage("Job with key " + job.Id + " already exists. Job will be ignored."); … … 488 490 clientCom.LogMessage("Starting Executor for job " + job.Id); 489 491 lock (executors) { 492 if (executors.ContainsKey(job.Id)) { 493 throw new JobAlreadyExistsException(job.Id); 494 } 490 495 executors.Add(job.Id, executor); 491 496 } 497 startInAppDomainMutex.ReleaseMutex(); 498 released = true; 492 499 semaphores[job.Id] = new Semaphore(0, 1); 493 500 executor.Start(jobData.Data); 494 501 semaphores[job.Id].Release(); 502 } 503 catch (JobAlreadyExistsException e) { 504 clientCom.LogMessage(string.Format("Job {0} has already been started. Job will be ignored", e.JobId)); 495 505 } 496 506 catch (Exception exception) { … … 507 517 KillAppDomain(job.Id); 508 518 } 509 } 510 } 519 520 if (!released) 521 startInAppDomainMutex.ReleaseMutex(); 522 } 511 523 heartbeatManager.AwakeHeartBeatThread(); 512 524 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/HeuristicLab.Clients.Hive.Slave-3.4.csproj
r5852 r6202 100 100 <Compile Include="Exceptions\JobNotFoundException.cs" /> 101 101 <Compile Include="Exceptions\JobNotDataFoundException.cs" /> 102 <Compile Include="Exceptions\JobAlreadyExistsException.cs" /> 102 103 <Compile Include="SlaveClientCom.cs" /> 103 104 <Compile Include="Core.cs" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/SlaveStatusInfo.cs
r5599 r6202 27 27 static public int JobsAborted { get; set; } 28 28 static public int JobsFetched { get; set; } 29 static public DateTime LoginTime { get; set; } 29 static public DateTime LoginTime { get; set; } 30 30 } 31 31 }
Note: See TracChangeset
for help on using the changeset viewer.