Changeset 1371


Ignore:
Timestamp:
03/19/09 17:30:33 (12 years ago)
Author:
kgrading
Message:

renamed the getLogger method (#529)

Location:
trunk/sources
Files:
4 edited

Legend:

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

    r782 r1371  
    4040    /// </summary>
    4141    /// <returns>the instance of the logger</returns>
    42     public static Logging GetInstance() {
     42    public static Logging Instance {
     43      get {
     44        if (instance == null)
     45         instance = new Logging();
     46        return instance;
     47      }
     48      set {}
     49    }
     50   
     51    static Logging GetInstance() {
    4352      if (instance == null)
    4453        instance = new Logging();
  • trunk/sources/HeuristicLab.Hive.Client.Communication/WcfService.cs

    r1367 r1371  
    9393          ConnectionRestored(this, new EventArgs());       
    9494      }
    95       catch (Exception ex) {
    96         //Todo: Rename to HandleNetworkError
    97         NetworkErrorHandling(ex);
     95      catch (Exception ex) {     
     96        HandleNetworkError(ex);
    9897      }
    9998    }
     
    126125    /// </summary>
    127126    /// <param name="e">The Exception</param>
    128     private void NetworkErrorHandling(Exception e) {
     127    private void HandleNetworkError(Exception e) {
    129128      ConnState = NetworkEnum.WcfConnState.Failed;
    130       Logging.GetInstance().Error(this.ToString(), "exception: ", e);
     129      Logging.Instance.Error(this.ToString(), "exception: ", e);
    131130    }
    132131
     
    146145        LoginCompleted(sender, e);
    147146      else
    148         NetworkErrorHandling(e.Error.InnerException);
     147        HandleNetworkError(e.Error.InnerException);
    149148    }
    150149
     
    154153          Response res = proxy.Login(clientInfo);
    155154          ConnState = NetworkEnum.WcfConnState.Loggedin;
    156           Logging.GetInstance().Info(this.ToString(), res.StatusMessage);
     155          Logging.Instance.Info(this.ToString(), res.StatusMessage);
    157156        }
    158157      }
    159158      catch (Exception e) {
    160         NetworkErrorHandling(e);
     159        HandleNetworkError(e);
    161160      }
    162161    }
     
    177176        SendJobCompleted(sender, e);
    178177      else
    179         NetworkErrorHandling(e.Error);
     178        HandleNetworkError(e.Error);
    180179    }
    181180    #endregion
     
    194193        ProcessJobResultCompleted(sender, e);
    195194      else
    196         NetworkErrorHandling(e.Error);
     195        HandleNetworkError(e.Error);
    197196    }
    198197
     
    214213        SendHeartBeatCompleted(sender, e);
    215214      else
    216         NetworkErrorHandling(e.Error);
     215        HandleNetworkError(e.Error);
    217216    }
    218217
  • trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs

    r1368 r1371  
    6969      abortRequested = false;
    7070
    71       Logging.GetInstance().Info(this.ToString(), "Hive Client started");
     71      Logging.Instance.Info(this.ToString(), "Hive Client started");
    7272      ClientConsoleServer server = new ClientConsoleServer();
    7373      server.StartClientConsoleServer(new Uri("net.tcp://127.0.0.1:8000/ClientConsole/"));
     
    102102        MessageContainer container = queue.GetMessage();
    103103        Debug.WriteLine("Main loop received this message: " + container.Message.ToString());
    104         Logging.GetInstance().Info(this.ToString(), container.Message.ToString());
     104        Logging.Instance.Info(this.ToString(), container.Message.ToString());
    105105        DetermineAction(container);
    106106      }
     
    175175      }
    176176      catch (InvalidStateException ise) {
    177         Logging.GetInstance().Error(this.ToString(), "Exception: ", ise);
     177        Logging.Instance.Error(this.ToString(), "Exception: ", ise);
    178178      }
    179179    }
     
    197197    void wcfService_LoginCompleted(object sender, LoginCompletedEventArgs e) {
    198198      if (e.Result.Success) {
    199         Logging.GetInstance().Info(this.ToString(), "Login completed to Hive Server @ " + DateTime.Now);       
     199        Logging.Instance.Info(this.ToString(), "Login completed to Hive Server @ " + DateTime.Now);       
    200200      } else
    201         Logging.GetInstance().Error(this.ToString(), e.Result.StatusMessage);
     201        Logging.Instance.Error(this.ToString(), e.Result.StatusMessage);
    202202    }   
    203203
     
    236236          //better expand the sendjobresultcompltedeventargs with a boolean "snapshot?" flag
    237237          if (e.Result.finished == false) {
    238             Logging.GetInstance().Info(this.ToString(), "Snapshot for Job " + e.Result.JobId + " transmitted");
     238            Logging.Instance.Info(this.ToString(), "Snapshot for Job " + e.Result.JobId + " transmitted");
    239239          } else {
    240240            AppDomain.Unload(appDomains[e.Result.JobId]);
     
    246246          }
    247247        }       
    248       } else {
    249         //Todo: don't Java Style! IT'S EVIL!
    250         Logging.GetInstance().Error(this.ToString(), "Sending of job " + e.Result.JobId + " failed");
     248      } else {       
     249        Logging.Instance.Error(this.ToString(), "Sending of job " + e.Result.JobId + " failed");
    251250      }
    252251    }
     
    254253    //Todo: First stop all threads, then terminate
    255254    void wcfService_ServerChanged(object sender, EventArgs e) {
    256       Logging.GetInstance().Info(this.ToString(), "ServerChanged has been called");
     255      Logging.Instance.Info(this.ToString(), "ServerChanged has been called");
    257256      lock (Locker) {
    258257        foreach (KeyValuePair<long, AppDomain> entries in appDomains)
     
    270269    //this is a little bit tricky -
    271270    void wcfService_ConnectionRestored(object sender, EventArgs e) {
    272       Logging.GetInstance().Info(this.ToString(), "Reconnected to old server - checking currently running appdomains");                 
     271      Logging.Instance.Info(this.ToString(), "Reconnected to old server - checking currently running appdomains");                 
    273272
    274273      foreach (KeyValuePair<long, Executor> execKVP in engines) {
    275274        if (!execKVP.Value.Running && execKVP.Value.CurrentMessage == MessageContainer.MessageType.NoMessage) {
    276           Logging.GetInstance().Info(this.ToString(), "Checking for JobId: " + execKVP.Value.JobId);
     275          Logging.Instance.Info(this.ToString(), "Checking for JobId: " + execKVP.Value.JobId);
    277276          Thread finThread = new Thread(new ParameterizedThreadStart(GetFinishedJob));
    278277          finThread.Start(execKVP.Value.JobId);
     
    288287
    289288    void appDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) {
    290       Logging.GetInstance().Error(this.ToString(), " Exception: " + e.ExceptionObject.ToString());
     289      Logging.Instance.Error(this.ToString(), " Exception: " + e.ExceptionObject.ToString());
    291290    }
    292291  }
  • trunk/sources/HeuristicLab.Hive.Client.Core/JobStorage/JobStorageManager.cs

    r1364 r1371  
    2828        storedJobsList.Add(info);
    2929        jobstream.Close();
    30         Logging.GetInstance().Info("JobStorrageManager", "Job " + info.JobID + " stored on the harddisc");
     30        Logging.Instance.Info("JobStorageManager", "Job " + info.JobID + " stored on the harddisc");
    3131      }
    3232      catch (Exception e) {
    33         //Todo: Change to logging.exception!
    34         Console.WriteLine(e);
     33        Logging.Instance.Error("JobStorageManager", "Exception: ", e);
    3534      }       
    3635    }
     
    4039        if (WcfService.Instance.ConnState == NetworkEnum.WcfConnState.Loggedin && (storedJobsList[index-1].ServerIP == WcfService.Instance.ServerIP && storedJobsList[index-1].ServerPort == WcfService.Instance.ServerPort)) {
    4140          String filename = storedJobsList[index-1].ServerIP + "." + storedJobsList[index-1].ServerPort + "." + storedJobsList[index-1].JobID.ToString();
    42           Logging.GetInstance().Info("JobStorrageManager", "Sending stored job " + storedJobsList[index-1].JobID + " to the server");
     41          Logging.Instance.Info("JobStorrageManager", "Sending stored job " + storedJobsList[index - 1].JobID + " to the server");
    4342          byte[] job = File.ReadAllBytes(path + filename + ".dat");
    4443         
     
    4746          //TODO: has to be fixed from server side
    4847          //if (res.Success == true) {
    49           Logging.GetInstance().Info("JobStorrageManager", "Sending of job " + storedJobsList[index - 1].JobID + " done"); 
     48          Logging.Instance.Info("JobStorrageManager", "Sending of job " + storedJobsList[index - 1].JobID + " done"); 
    5049          storedJobsList.Remove(storedJobsList[index - 1]);
    5150          File.Delete(path + filename + ".dat");
Note: See TracChangeset for help on using the changeset viewer.