Пример #1
0
 private void MonitorDeadClients()
 {
     while (this._worker != null && this._worker.IsAlive)
     {
         ArrayList suspectedClients = new ArrayList();
         lock (syncRoot)
         {
             if (this._deadClients.Count < 1)
             {
                 Monitor.Wait(syncRoot);
             }
             Dictionary <string, DateTime>             tempList = new Dictionary <string, DateTime>(_deadClients);
             Dictionary <string, DateTime> .Enumerator ide      = tempList.GetEnumerator();
             while (ide.MoveNext())
             {
                 DateTime expireTime = ide.Current.Value.AddMilliseconds(this._gracePeriod);
                 if (expireTime < DateTime.Now)
                 {
                     continue;
                 }
                 suspectedClients.Add(ide.Current.Key);
                 if (_deadClients.ContainsKey(ide.Current.Key))
                 {
                     lock (syncRoot) _deadClients.Remove(ide.Current.Key);
                 }
             }
         }
         if (suspectedClients.Count == 0)
         {
             continue;
         }
         ArrayList deadClients = _cacheImpl.DetermineClientConnectivity(suspectedClients);
         _cacheImpl.DeclaredDeadClients(deadClients);
     }
 }