Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/07/11 16:15:55 (14 years ago)
Author:
ascheibe
Message:

#1233

  • use mac address as Guid for Slaves (for now...)
  • Slave Windows Service now also works if it can't write to an event source
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.SlaveWindowsService/SlaveWindowsService.cs

    r5599 r5621  
    1919 */
    2020#endregion
     21using System;
    2122using System.ServiceProcess;
    2223using System.Threading;
    23 using HeuristicLab.Clients.Hive.SlaveCore;
    2424
    2525namespace HeuristicLab.Clients.Hive.SlaveCore.SlaveWindowsService {
     
    3030    public SlaveWindowsService() {
    3131      InitializeComponent();
    32       if (!System.Diagnostics.EventLog.SourceExists("HeuristicLab Hive Slave"))
    33         System.Diagnostics.EventLog.CreateEventSource("HeuristicLab Hive Slave",
    34                                                               "HeuristicLab Hive Slave");
    3532
    36       eventLog.Source = "HeuristicLab Hive Slave";
    37       eventLog.Log = "HeuristicLab Hive Slave";
     33      try {
     34        if (!System.Diagnostics.EventLog.SourceExists("HLHive")) {
     35          System.Diagnostics.EventLog.CreateEventSource("HLHive", "Slave");
     36        }
     37        eventLog.Source = "HLHive";
     38        eventLog.Log = "Slave";
     39      }
     40      catch (Exception) { }
    3841    }
    3942
     
    4245      coreThread = new Thread(core.Start);
    4346      coreThread.Start();
    44       eventLog.WriteEntry("HeuristicLab Hive Slave started!");
     47
     48      try {
     49        eventLog.WriteEntry("HeuristicLab Hive Slave started!");
     50      }
     51      catch (Exception) { }
    4552    }
    4653
    4754    protected override void OnStop() {
    48       eventLog.WriteEntry("Shutting down HeuristicLab Hive Slave...");
     55      try {
     56        eventLog.WriteEntry("Shutting down HeuristicLab Hive Slave...");
     57      }
     58      catch (Exception) { }
     59
    4960      core.Shutdown();
    50       eventLog.WriteEntry("HeuristicLab Hive Slave stopped!");
     61
     62      try {
     63        eventLog.WriteEntry("HeuristicLab Hive Slave stopped!");
     64      }
     65      catch (Exception) { }
    5166    }
    5267  }
Note: See TracChangeset for help on using the changeset viewer.