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
Afficher le fichier Open project: michael-lang/candor-common

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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 méthode

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

FormatServerName() protected méthode

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

GetExpectedAgeMinutes() protected méthode

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

Initialize() public méthode

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.
Résultat void

IsMonitorEnabled() protected méthode

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

OnWaitingPeriodElapsed() public méthode

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
Résultat void

RestartServer() protected méthode

Force Restarts the service, if possible.
protected RestartServer ( ) : bool
Résultat bool

RestartService() protected méthode

Restarts the windows service, if possible.
protected RestartService ( ) : bool
Résultat bool

ValidateServiceFile() protected méthode

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
Résultat bool

ValidateWindowsService() protected méthode

Validates if a windows service is running.
protected ValidateWindowsService ( ) : bool
Résultat bool