Example #1
0
 public override void Run()
 {
     try
     {
         while (true)
         {
             // take the first host that has an expired penalty
             MapHost host = this._enclosing.penalties.Take().host;
             lock (this._enclosing._enclosing)
             {
                 if (host.MarkAvailable() == MapHost.State.Pending)
                 {
                     this._enclosing.pendingHosts.AddItem(host);
                     Sharpen.Runtime.NotifyAll(this._enclosing._enclosing);
                 }
             }
         }
     }
     catch (Exception)
     {
         return;
     }
     catch (Exception t)
     {
         this._enclosing.reporter.ReportException(t);
     }
 }
Example #2
0
 public virtual void FreeHost(MapHost host)
 {
     lock (this)
     {
         if (host.GetState() != MapHost.State.Penalized)
         {
             if (host.MarkAvailable() == MapHost.State.Pending)
             {
                 pendingHosts.AddItem(host);
                 Sharpen.Runtime.NotifyAll(this);
             }
         }
         Log.Info(host + " freed by " + Sharpen.Thread.CurrentThread().GetName() + " in "
                  + (Time.MonotonicNow() - shuffleStart.Get()) + "ms");
     }
 }