Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/27/09 14:04:47 (15 years ago)
Author:
svonolfe
Message:

Refactored DAL (now using GUIDs as IDs instead of longs) (#527)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs

    r1379 r1449  
    5252  public class Core: MarshalByRefObject {       
    5353    public static bool abortRequested { get; set; }
    54        
    55     private Dictionary<long, Executor> engines = new Dictionary<long, Executor>();
    56     private Dictionary<long, AppDomain> appDomains = new Dictionary<long, AppDomain>();
    57     private Dictionary<long, Job> jobs = new Dictionary<long, Job>();
     54
     55    private Dictionary<Guid, Executor> engines = new Dictionary<Guid, Executor>();
     56    private Dictionary<Guid, AppDomain> appDomains = new Dictionary<Guid, AppDomain>();
     57    private Dictionary<Guid, Job> jobs = new Dictionary<Guid, Job>();
    5858
    5959    private WcfService wcfService;
     
    129129        //Pull a Job from the Server
    130130        case MessageContainer.MessageType.FetchJob:
    131           wcfService.SendJobAsync(ConfigManager.Instance.GetClientInfo().ClientId);
     131          wcfService.SendJobAsync(ConfigManager.Instance.GetClientInfo().Id);
    132132          break;         
    133133        //A Job has finished and can be sent back to the server
     
    147147   
    148148    private void GetFinishedJob(object jobId) {
    149       long jId = (long)jobId;     
     149      Guid jId = (Guid)jobId;     
    150150      try {
    151151        byte[] sJob = engines[jId].GetFinishedJob();
    152152
    153153        if (WcfService.Instance.ConnState == NetworkEnum.WcfConnState.Loggedin) {
    154           wcfService.StoreFinishedJobResultAsync(ConfigManager.Instance.GetClientInfo().ClientId,
     154          wcfService.StoreFinishedJobResultAsync(ConfigManager.Instance.GetClientInfo().Id,
    155155            jId,
    156156            sJob,
     
    174174
    175175    private void GetSnapshot(object jobId) {
    176       long jId = (long)jobId;
     176      Guid jId = (Guid)jobId;
    177177      byte[] obj = engines[jId].GetSnapshot();
    178       wcfService.ProcessSnapshotAsync(ConfigManager.Instance.GetClientInfo().ClientId,
     178      wcfService.ProcessSnapshotAsync(ConfigManager.Instance.GetClientInfo().Id,
    179179        jId,
    180180        obj,
     
    249249      Logging.Instance.Info(this.ToString(), "ServerChanged has been called");
    250250      lock (engines) {
    251         foreach (KeyValuePair<long, AppDomain> entries in appDomains)
     251        foreach (KeyValuePair<Guid, AppDomain> entries in appDomains)
    252252          AppDomain.Unload(appDomains[entries.Key]);
    253         appDomains = new Dictionary<long, AppDomain>();
    254         engines = new Dictionary<long, Executor>();
     253        appDomains = new Dictionary<Guid, AppDomain>();
     254        engines = new Dictionary<Guid, Executor>();
    255255      }
    256256    }
     
    265265      Logging.Instance.Info(this.ToString(), "Reconnected to old server - checking currently running appdomains");                 
    266266
    267       foreach (KeyValuePair<long, Executor> execKVP in engines) {
     267      foreach (KeyValuePair<Guid, Executor> execKVP in engines) {
    268268        if (!execKVP.Value.Running && execKVP.Value.CurrentMessage == MessageContainer.MessageType.NoMessage) {
    269269          Logging.Instance.Info(this.ToString(), "Checking for JobId: " + execKVP.Value.JobId);
     
    276276    #endregion
    277277
    278     public Dictionary<long, Executor> GetExecutionEngines() {
     278    public Dictionary<Guid, Executor> GetExecutionEngines() {
    279279      return engines;
    280280    }
Note: See TracChangeset for help on using the changeset viewer.