Beispiel #1
0
 /**
  * Add {@link HystrixCommand} instance to the request log.
  *
  * @param command
  *            {@code HystrixCommand<?>}
  */
 internal void AddExecutedCommand(HystrixCommand command)
 {
     if (!executedCommands.Offer(command))
     {
         // see RequestLog: Reduce Chance of Memory Leak https://github.com/Netflix/Hystrix/issues/53
         logger.Warn("RequestLog ignoring command after reaching limit of " + MaxStorage + ". See https://github.com/Netflix/Hystrix/issues/53 for more information.");
     }
 }
 private LinkedBlockingQueue<String> PopulatedDeque(int n)
 {
     LinkedBlockingQueue<String> q = new LinkedBlockingQueue<String>(n);
     Assert.IsTrue(q.IsEmpty());
     for(int i = 0; i < n; i++)
     {
         Assert.IsTrue(q.Offer(i.ToString()));
     }
     Assert.IsFalse(q.IsEmpty());
     Assert.AreEqual(0, q.RemainingCapacity());
     Assert.AreEqual(n, q.Size());
     return q;
 }
 public void TestOfferNull()
 {
     try
     {
         LinkedBlockingQueue<String> q = new LinkedBlockingQueue<String>();
         q.Offer(null);
         ShouldThrow();
     }
     catch (NullReferenceException) {}
 }
 public void TestOffer()
 {
     LinkedBlockingQueue<String> q = new LinkedBlockingQueue<String>(1);
     Assert.IsTrue(q.Offer(zero));
     Assert.IsFalse(q.Offer(one));
 }
 public void TestEmptyFull()
 {
     LinkedBlockingQueue<String> q = new LinkedBlockingQueue<String>(2);
     Assert.IsTrue(q.IsEmpty());
     Assert.AreEqual(2, q.RemainingCapacity(), "should have room for 2");
     q.Add(one);
     Assert.IsFalse(q.IsEmpty());
     q.Add(two);
     Assert.IsFalse(q.IsEmpty());
     Assert.AreEqual(0, q.RemainingCapacity());
     Assert.IsFalse(q.Offer(three));
 }