public HealthMonitorPushClient DefineEndpoint(Action<IEndpointDefintionBuilder> definitionBuilder)
 {
     if (_definition != null)
         throw new InvalidOperationException("Endpoint already defined.");
     var builder = new EndpointDefintionBuilder();
     definitionBuilder.Invoke(builder);
     _definition = builder.Build();
     return this;
 }
 public EndpointHealthNotifier(IHealthMonitorClient client, ITimeCoordinator timeCoordinator, EndpointDefinition definition, IHealthChecker healthChecker)
 {
     _client = client;
     _timeCoordinator = timeCoordinator;
     _definition = definition;
     _healthChecker = healthChecker;
     _cancelationTokenSource = new CancellationTokenSource();
     _healthCheckInterval = new CachedValue<TimeSpan>(HealthCheckIntervalCacheDuration, GetHealthCheckIntervalAsync);
     _thread = new Thread(HealthLoop) { IsBackground = true, Name = "Health Check loop" };
     _thread.Start();
 }