コード例 #1
0
        private void WaitUntilReady(IHostService hostService)
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            for (; ;)
            {
                EnsureProcessIsRunning();

                try
                {
                    hostService.Ping();
                    return;
                }
                catch (Exception)
                {
                    if (stopwatch.Elapsed >= ReadyTimeout)
                    {
                        throw;
                    }
                }

                EnsureProcessIsRunning();
                Thread.Sleep(ReadyPollInterval);
            }
        }
コード例 #2
0
ファイル: RemoteHost.cs プロジェクト: kuzeygh/mbunit-v3
        private void PingTimerElapsed(object state)
        {
            bool pinged = false;

            try
            {
                lock (pingLock)
                {
                    if (pingInProgress || pingTimer == null)
                    {
                        return;
                    }

                    pinged         = true;
                    pingInProgress = true;
                }

#if DEBUG // FIXME: For debugging the remoting starvation issue.  See Google Code issue #147.  Remove when fixed.
                RuntimeAccessor.Logger.Log(LogSeverity.Debug, String.Format("[Ping] {0:o}", DateTime.Now));
#endif
                IHostService hostService = HostService;
                if (hostService != null)
                {
                    hostService.Ping();
                }

                lastPingFailed = false;
            }
            catch (Exception ex)
            {
                if (!lastPingFailed)
                {
                    Logger.Log(LogSeverity.Warning, "Could not send Ping message to the remote host service.", ex);
                    lastPingFailed = true;
                }
            }
            finally
            {
                if (pinged)
                {
                    pingInProgress = false;
                }
            }
        }
コード例 #3
0
        private void WaitUntilReady(IHostService hostService)
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            for (; ; )
            {
                EnsureProcessIsRunning();

                try
                {
                    hostService.Ping();
                    return;
                }
                catch (Exception)
                {
                    if (stopwatch.Elapsed >= ReadyTimeout)
                        throw;
                }

                EnsureProcessIsRunning();
                Thread.Sleep(ReadyPollInterval);
            }
        }