C# Class Candor.Tasks.ServiceProcess.ServiceMonitorWorkerRoleTask

Monitors that a service is up either directly or by checking for updates to a file that it generates. When a monitored service stops working, attempts are made to restart the service or the server it runs on.
The service being monitored can be on any machine in the same domain. If not on a domain, then only the current machine can be monitored and restarted.
Inheritance: RepeatingWorkerRoleTask
Show file Open project: michael-lang/candor-common

Public Methods

Method Description
Initialize ( string name, NameValueCollection configValue ) : void

Initializes the provider with the specified values.

OnWaitingPeriodElapsed ( ) : void

The code to be executed everytime the waiting period elapses.

This will complete before the waiting period until the next iteration begins.

Protected Methods

Method Description
AssertConfigurationValid ( ) : void

Ensures the configuration is valid, otherwise it throws an ArgumentException.

FormatServerName ( string name ) : string

Formats a server name for use by management API to restart the server.

GetExpectedAgeMinutes ( ) : Int32

Gets the expected file age in minutes, or the max file age if the expected age is not specified.

IsMonitorEnabled ( ) : bool

Possible expansion point to disable the service monitor at preconfigured times.

RestartServer ( ) : bool

Force Restarts the service, if possible.

RestartService ( ) : bool

Restarts the windows service, if possible.

ValidateServiceFile ( ) : bool

Validates that a service file exists, and if not it is logged. A custom logger should be provided to notify the appropriate party.

ValidateWindowsService ( ) : bool

Validates if a windows service is running.

Method Details

AssertConfigurationValid() protected method

Ensures the configuration is valid, otherwise it throws an ArgumentException.
protected AssertConfigurationValid ( ) : void
return void

FormatServerName() protected method

Formats a server name for use by management API to restart the server.
protected FormatServerName ( string name ) : string
name string
return string

GetExpectedAgeMinutes() protected method

Gets the expected file age in minutes, or the max file age if the expected age is not specified.
protected GetExpectedAgeMinutes ( ) : Int32
return System.Int32

Initialize() public method

Initializes the provider with the specified values.
public Initialize ( string name, NameValueCollection configValue ) : void
name string The name of the provider.
configValue System.Collections.Specialized.NameValueCollection Provider specific attributes.
return void

IsMonitorEnabled() protected method

Possible expansion point to disable the service monitor at preconfigured times.
protected IsMonitorEnabled ( ) : bool
return bool

OnWaitingPeriodElapsed() public method

The code to be executed everytime the waiting period elapses.
This will complete before the waiting period until the next iteration begins.
public OnWaitingPeriodElapsed ( ) : void
return void

RestartServer() protected method

Force Restarts the service, if possible.
protected RestartServer ( ) : bool
return bool

RestartService() protected method

Restarts the windows service, if possible.
protected RestartService ( ) : bool
return bool

ValidateServiceFile() protected method

Validates that a service file exists, and if not it is logged. A custom logger should be provided to notify the appropriate party.
protected ValidateServiceFile ( ) : bool
return bool

ValidateWindowsService() protected method

Validates if a windows service is running.
protected ValidateWindowsService ( ) : bool
return bool