HADOOP-7593. Fix AssertionError in TestHttpServer.testMaxThreads(). Contributed by Uma Maheswara Rao G
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1163465 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1cd3791172
commit
f10c97d390
@ -536,6 +536,9 @@ Release 0.23.0 - Unreleased
|
||||
HADOOP-7576. Fix findbugs warnings and javac warnings in hadoop-auth.
|
||||
(szetszwo)
|
||||
|
||||
HADOOP-7593. Fix AssertionError in TestHttpServer.testMaxThreads().
|
||||
(Uma Maheswara Rao G via szetszwo)
|
||||
|
||||
Release 0.22.0 - Unreleased
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
@ -178,7 +178,7 @@ public HttpServer(String name, String bindAddress, int port,
|
||||
|
||||
int maxThreads = conf.getInt(HTTP_MAX_THREADS, -1);
|
||||
// If HTTP_MAX_THREADS is not configured, QueueThreadPool() will use the
|
||||
// default value (currently 254).
|
||||
// default value (currently 250).
|
||||
QueuedThreadPool threadPool = maxThreads == -1 ?
|
||||
new QueuedThreadPool() : new QueuedThreadPool(maxThreads);
|
||||
webServer.setThreadPool(threadPool);
|
||||
|
@ -18,9 +18,7 @@
|
||||
package org.apache.hadoop.http;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.URLConnection;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
@ -131,7 +129,9 @@ public void doGet(HttpServletRequest request,
|
||||
}
|
||||
|
||||
@BeforeClass public static void setup() throws Exception {
|
||||
server = createTestServer();
|
||||
Configuration conf = new Configuration();
|
||||
conf.setInt(HttpServer.HTTP_MAX_THREADS, 10);
|
||||
server = createTestServer(conf);
|
||||
server.addServlet("echo", "/echo", EchoServlet.class);
|
||||
server.addServlet("echomap", "/echomap", EchoMapServlet.class);
|
||||
server.addServlet("htmlcontent", "/htmlcontent", HtmlContentServlet.class);
|
||||
@ -161,7 +161,8 @@ public void run() {
|
||||
assertEquals("a:b\nc:d\n",
|
||||
readOutput(new URL(baseUrl, "/echo?a=b&c=d")));
|
||||
int serverThreads = server.webServer.getThreadPool().getThreads();
|
||||
assertTrue(serverThreads <= MAX_THREADS);
|
||||
assertTrue("More threads are started than expected, Server Threads count: "
|
||||
+ serverThreads, serverThreads <= MAX_THREADS);
|
||||
System.out.println("Number of threads = " + serverThreads +
|
||||
" which is less or equal than the max = " + MAX_THREADS);
|
||||
} catch (Exception e) {
|
||||
|
Loading…
Reference in New Issue
Block a user