Package com.linkedin.r2.transport.http.client

Examples of com.linkedin.r2.transport.http.client.RateLimiter.submit()


    long start = System.currentTimeMillis();
    long lowTolerance = (total * period) * 4 / 5;
    long highTolerance = (total * period) * 5 / 4;
    for (int i = 0; i < total * period; i++)
    {
      limiter.submit(incr);
    }
    Assert.assertTrue(latch.await(highTolerance, TimeUnit.MILLISECONDS),
                      "Should have finished within " + highTolerance + "ms");
    long t = System.currentTimeMillis() - start;
    Assert.assertTrue(t > lowTolerance, "Should have finished after " + lowTolerance + "ms (took " + t + ")");
View Full Code Here


        _period += 50;
      }
    }, 0, 100, TimeUnit.MILLISECONDS);

    RateLimiterRunner runner = new RateLimiterRunner(System.currentTimeMillis());
    rl.submit(runner);

    try {
      Assert.assertTrue(runner.getElapsedTime() <= MAXPERIOD, "Elapsed Time exceed MAX Period");
    } catch (Exception e) {
      Assert.fail("Unexpected failure", e);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.