Package com.splout.db.dnode.Fetcher

Examples of com.splout.db.dnode.Fetcher.Throttler


public class TestFetcher {

  @Test
  public void testThrottling() throws InterruptedException {
    double bytesPerSec = 1000;
    Throttler throttler = new Throttler(bytesPerSec);
    long startTime = System.currentTimeMillis();
   
    int bytesConsumed = 0;
   
    for(int i = 0; i < 10; i++) {
      int bytes = (int)(Math.random() * 1000);
      bytesConsumed += bytes;
      throttler.incrementAndThrottle(bytes)
    }
   
    long endTime = System.currentTimeMillis();
    double secs = (endTime - startTime) / (double)1000;
    double avgBytesPerSec = bytesConsumed / secs;
View Full Code Here

TOP

Related Classes of com.splout.db.dnode.Fetcher.Throttler

Copyright © 2018 www.massapicom. 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.