protected virtual void TriggerRelease(Event @event = null)
 {
     while (ReleaseQueue.Count > 0)
     {
         var release = ReleaseQueue.Peek();
         if (release.Request.IsAlive)
         {
             if (!RequestQueue.TryRemove((PreemptiveRequest)release.Request))
             {
                 throw new InvalidOperationException("Failed to cancel a request.");
             }
             release.Succeed();
             ReleaseQueue.Dequeue();
         }
         else
         {
             DoRelease(release);
             if (release.IsTriggered)
             {
                 ReleaseQueue.Dequeue();
                 TriggerWhenAny();
                 TriggerWhenFull();
                 TriggerWhenChange();
             }
             else
             {
                 break;
             }
         }
     }
 }
Beispiel #2
0
 protected virtual void TriggerRelease(Event @event = null)
 {
     while (ReleaseQueue.Count > 0)
     {
         var release = ReleaseQueue.Peek();
         if (release.Request.IsAlive)
         {
             if (!RequestQueue.Remove(release.Request))
             {
                 throw new InvalidOperationException("Failed to cancel a request.");
             }
             BreakOffTime?.Add(Environment.ToDouble(Environment.Now - release.Request.Time));
             release.Succeed();
             ReleaseQueue.Dequeue();
         }
         else
         {
             DoRelease(release);
             if (release.IsTriggered)
             {
                 ReleaseQueue.Dequeue();
                 TriggerWhenAny();
                 TriggerWhenFull();
                 TriggerWhenChange();
             }
             else
             {
                 break;
             }
         }
     }
     Utilization?.UpdateTo(InUse / (double)Capacity);
     WIP?.UpdateTo(InUse + RequestQueue.Count);
     QueueLength?.UpdateTo(RequestQueue.Count);
 }
Beispiel #3
0
 protected virtual void TriggerRelease(Event @event = null)
 {
     while (ReleaseQueue.Count > 0)
     {
         var release = ReleaseQueue.Peek();
         DoRelease(release);
         if (release.IsTriggered)
         {
             ReleaseQueue.Dequeue();
         }
         else
         {
             break;
         }
     }
 }
Beispiel #4
0
 protected override void TriggerRelease(Event @event = null)
 {
     while (ReleaseQueue.Count > 0)
     {
         var release = ReleaseQueue.Peek();
         this.DoRelease(release);
         if (release.Request.IsTriggered)
         {
             ReleaseQueue.Dequeue();
         }
         else
         {
             break;
         }
     }
 }