Example usage for org.apache.http.client.benchmark Stats Stats

List of usage examples for org.apache.http.client.benchmark Stats Stats

Introduction

In this page you can find the example usage for org.apache.http.client.benchmark Stats Stats.

Prototype

public Stats(int expectedCount, int concurrency) 

Source Link

Usage

From source file:org.apache.http.client.benchmark.TestHttpClient3.java

Stats execute(final URI target, final byte[] content, int n, int c) throws Exception {
    this.mgr.getParams().setMaxTotalConnections(2000);
    this.mgr.getParams().setDefaultMaxConnectionsPerHost(c);
    Stats stats = new Stats(n, c);
    WorkerThread[] workers = new WorkerThread[c];
    for (int i = 0; i < workers.length; i++) {
        workers[i] = new WorkerThread(stats, target, content);
    }/*from   w w w .  j a va 2  s . co m*/
    for (int i = 0; i < workers.length; i++) {
        workers[i].start();
    }
    for (int i = 0; i < workers.length; i++) {
        workers[i].join();
    }
    return stats;
}