/// <summary> /// Initializes a new instance of the <see cref="FileHealthCheck" /> class. /// </summary> /// <param name="configuration"><see cref="T:TcmCDService.Configuration.HealthCheckTypeElement" /></param> public FileHealthCheck(HealthCheckTypeElement configuration) : base(configuration) { mPath = Settings.Get <String>("path"); if (String.IsNullOrEmpty(mPath)) { throw new ConfigurationErrorsException("No configured \"path\" for FileHealthCheck"); } try { Directory.CreateDirectory(Path.GetDirectoryName(mPath)); } catch (Exception ex) { throw new ConfigurationErrorsException("Cannot create \"path\" for FileHealthCheck", ex); } mInterval = Settings.Get <int>("interval"); if (String.IsNullOrEmpty(mPath)) { throw new ConfigurationErrorsException("No configured \"interval\" for FileHealthCheck"); } mCancellationTokenSource = new CancellationTokenSource(); mTask = new Task(() => ScheduledHealthCheck(mCancellationTokenSource.Token), TaskCreationOptions.LongRunning); mTask.Start(); }
/// <summary> /// Initializes a new instance of the <see cref="BaseHealthCheck" /> class. /// </summary> /// <param name="configuration"><see cref="T:TcmCDService.Configuration.HealthCheckTypeElement" /></param> protected BaseHealthCheck(HealthCheckTypeElement configuration) : base(configuration) { }
/// <summary> /// Initializes a new instance of the <see cref="WebHealthCheck" /> class. /// </summary> /// <param name="configuration"><see cref="T:TcmCDService.Configuration.HealthCheckTypeElement" /></param> public WebHealthCheck(HealthCheckTypeElement configuration) : base(configuration) { mServicehost = new ServiceHost(this); mServicehost.Open(); }
/// <summary> /// Initializes a new instance of the <see cref="HealthCheckType" /> class. /// </summary> /// <param name="configuration"><see cref="T:TcmCDService.Configuration.HealthCheckTypeElement" /></param> protected HealthCheckType(HealthCheckTypeElement configuration) { mHealthChecks = configuration.HealthChecks; mSettings = new Settings(configuration.Settings); }