Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6202


Ignore:
Timestamp:
05/16/11 16:10:10 (14 years ago)
Author:
cneumuel
Message:

#1233

  • stability fixes for slave
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  
    443443
    444444    private static object startInAppDomainLocker = new object();
    445 
     445    private static Mutex startInAppDomainMutex = new Mutex();
    446446    /// <summary>
    447447    /// A new Job from the wcfService has been received and will be started within a AppDomain.
     
    451451      clientCom.StatusChanged(ConfigManager.Instance.GetStatusForClientConsole());
    452452
    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
    454456        if (executors.ContainsKey(job.Id)) {
    455457          clientCom.LogMessage("Job with key " + job.Id + " already exists. Job will be ignored.");
     
    488490            clientCom.LogMessage("Starting Executor for job " + job.Id);
    489491            lock (executors) {
     492              if (executors.ContainsKey(job.Id)) {
     493                throw new JobAlreadyExistsException(job.Id);
     494              }
    490495              executors.Add(job.Id, executor);
    491496            }
     497            startInAppDomainMutex.ReleaseMutex();
     498            released = true;
    492499            semaphores[job.Id] = new Semaphore(0, 1);
    493500            executor.Start(jobData.Data);
    494501            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));
    495505          }
    496506          catch (Exception exception) {
     
    507517            KillAppDomain(job.Id);
    508518          }
    509         }
    510       }
     519
     520          if (!released)
     521            startInAppDomainMutex.ReleaseMutex();
     522        }
    511523      heartbeatManager.AwakeHeartBeatThread();
    512524    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/HeuristicLab.Clients.Hive.Slave-3.4.csproj

    r5852 r6202  
    100100    <Compile Include="Exceptions\JobNotFoundException.cs" />
    101101    <Compile Include="Exceptions\JobNotDataFoundException.cs" />
     102    <Compile Include="Exceptions\JobAlreadyExistsException.cs" />
    102103    <Compile Include="SlaveClientCom.cs" />
    103104    <Compile Include="Core.cs" />
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/SlaveStatusInfo.cs

    r5599 r6202  
    2727    static public int JobsAborted { get; set; }
    2828    static public int JobsFetched { get; set; }
    29     static public DateTime LoginTime { get; set; }           
     29    static public DateTime LoginTime { get; set; }
    3030  }
    3131}
Note: See TracChangeset for help on using the changeset viewer.