Changeset 6202 for branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs
- Timestamp:
- 05/16/11 16:10:10 (13 years ago)
- File:
-
- 1 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 }
Note: See TracChangeset
for help on using the changeset viewer.