Candor.Tasks.ServiceProcess.ServiceMonitorWorkerRoleTask.OnWaitingPeriodElapsed C# (CSharp) Method

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
        public override void OnWaitingPeriodElapsed()
        {
            AssertConfigurationValid();
            if (!IsMonitorEnabled())
            {
                LogProvider.DebugFormat("This service monitor is disabled at this time: {0}", Name);
                return;
            }
            bool ok = ValidateServiceFile() && ValidateWindowsService();

            if (!ok)
                ok = RestartService();
            if (!ok)
                ok = RestartServer();
            if (!ok)
            {
                LogProvider.WarnFormat("Non-functional service could not be restarted, '{0}'.", Name);
            }
            else
            {
                LogProvider.DebugFormat("Functional service '{0}'.", Name);
            }
        }