Upgraded Jetty; minor benchmark improvements

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1080382 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2011-03-10 22:45:30 +00:00
parent f3e3302b7e
commit dcfced133b
6 changed files with 20 additions and 6 deletions

View File

@ -74,13 +74,13 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>7.2.2.v20101205</version>
<version>7.3.1.v20110307</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
<version>7.2.2.v20101205</version>
<version>7.3.1.v20110307</version>
<scope>compile</scope>
</dependency>
<dependency>

View File

@ -90,6 +90,7 @@ public class Benchmark {
content[i] = (byte) ((r + i) % 96 + 32);
}
URI warmup = new URI("http", null, "localhost", port, "/rnd", "c=2048", null);
URI target1 = new URI("http", null, "localhost", port, "/rnd", "c=" + contentLen, null);
URI target2 = new URI("http", null, "localhost", port, "/echo", null, null);
@ -98,7 +99,7 @@ public class Benchmark {
try {
agent.init();
// Warm up
agent.get(target1, 5, 500);
agent.get(warmup, 5, 500);
// Sleep a little
Thread.sleep(5000);
System.out.println("=================================");

View File

@ -125,7 +125,11 @@ public class TestHttpClient3 implements TestHttpAgent {
contentLen += l;
}
}
this.stats.success(contentLen);
if (httpmethod.getStatusCode() == 200) {
this.stats.success(contentLen);
} else {
this.stats.failure(contentLen);
}
} catch (IOException ex) {
this.stats.failure(contentLen);
} finally {

View File

@ -151,7 +151,11 @@ public class TestHttpClient4 implements TestHttpAgent {
instream.close();
}
}
this.stats.success(contentLen);
if (response.getStatusLine().getStatusCode() == 200) {
this.stats.success(contentLen);
} else {
this.stats.failure(contentLen);
}
} catch (IOException ex) {
this.stats.failure(contentLen);
request.abort();

View File

@ -195,7 +195,11 @@ public class TestHttpCore implements TestHttpAgent {
it.next();
it.remove();
}
this.stats.success(contentLen);
if (response.getStatusLine().getStatusCode() == 200) {
this.stats.success(contentLen);
} else {
this.stats.failure(contentLen);
}
} catch (IOException ex) {
this.stats.failure(contentLen);
} catch (HttpException ex) {

View File

@ -70,6 +70,7 @@ public class TestJettyHttpClient implements TestHttpAgent {
try {
this.client.send(exchange);
} catch (IOException ex) {
stats.failure(0);
}
}
stats.waitFor();