Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/06/11 14:30:47 (12 years ago)
Author:
ascheibe
Message:

#1672 some fixes for the slave tray ui:

  • removed some more magic numbers
  • fixed reconnecting to windows service when it was stopped
  • added more time for stopping/starting windows service so that no exception is thrown because of a timeout
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/SlaveCmdsWithKill.cs

    r6983 r7135  
    126126
    127127    private void StartService() {
    128       TimeSpan timeout = TimeSpan.FromMilliseconds(5000);
    129 
    130128      ServiceController service = new ServiceController(serviceName);
    131129      try {
    132130        if (service.Status == ServiceControllerStatus.Running) {
    133131          service.Stop();
    134           service.WaitForStatus(ServiceControllerStatus.Stopped, timeout);
     132          service.WaitForStatus(ServiceControllerStatus.Stopped, Settings.Default.ServiceStartStopTimeout);
    135133        }
    136134
    137135        service.Start();
    138         service.WaitForStatus(ServiceControllerStatus.Running, timeout);
     136        service.WaitForStatus(ServiceControllerStatus.Running, Settings.Default.ServiceStartStopTimeout);
    139137      }
    140138      catch (InvalidOperationException ex) {
     
    147145
    148146    private void StopService() {
    149       TimeSpan timeout = TimeSpan.FromMilliseconds(7000);
    150 
    151147      ServiceController service = new ServiceController(serviceName);
    152148      try {
    153149        if (service.Status == ServiceControllerStatus.Running) {
    154150          service.Stop();
    155           service.WaitForStatus(ServiceControllerStatus.Stopped, timeout);
     151          service.WaitForStatus(ServiceControllerStatus.Stopped, Settings.Default.ServiceStartStopTimeout);
    156152        }
    157153      }
    158154      catch (InvalidOperationException ex) {
    159         MessageBox.Show("Error starting service: Hive Slave Service not found!" + Environment.NewLine + ex.ToString());
     155        MessageBox.Show("Error stopping service: Hive Slave Service not found!" + Environment.NewLine + ex.ToString());
    160156      }
    161157      catch (Exception ex) {
    162         MessageBox.Show("Error starting service, exception is: " + Environment.NewLine + ex.ToString());
     158        MessageBox.Show("Error stopping service, exception is: " + Environment.NewLine + ex.ToString());
    163159      }
    164160    }
Note: See TracChangeset for help on using the changeset viewer.