svn merge -c 1163465 from trunk for HADOOP-7593. Contributed by Uma Maheswara Rao G
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1163466 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0fdcf88498
commit
7214f64b2c
|
@ -534,6 +534,9 @@ Release 0.23.0 - Unreleased
|
||||||
HADOOP-7576. Fix findbugs warnings and javac warnings in hadoop-auth.
|
HADOOP-7576. Fix findbugs warnings and javac warnings in hadoop-auth.
|
||||||
(szetszwo)
|
(szetszwo)
|
||||||
|
|
||||||
|
HADOOP-7593. Fix AssertionError in TestHttpServer.testMaxThreads().
|
||||||
|
(Uma Maheswara Rao G via szetszwo)
|
||||||
|
|
||||||
Release 0.22.0 - Unreleased
|
Release 0.22.0 - Unreleased
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -178,7 +178,7 @@ public class HttpServer implements FilterContainer {
|
||||||
|
|
||||||
int maxThreads = conf.getInt(HTTP_MAX_THREADS, -1);
|
int maxThreads = conf.getInt(HTTP_MAX_THREADS, -1);
|
||||||
// If HTTP_MAX_THREADS is not configured, QueueThreadPool() will use the
|
// If HTTP_MAX_THREADS is not configured, QueueThreadPool() will use the
|
||||||
// default value (currently 254).
|
// default value (currently 250).
|
||||||
QueuedThreadPool threadPool = maxThreads == -1 ?
|
QueuedThreadPool threadPool = maxThreads == -1 ?
|
||||||
new QueuedThreadPool() : new QueuedThreadPool(maxThreads);
|
new QueuedThreadPool() : new QueuedThreadPool(maxThreads);
|
||||||
webServer.setThreadPool(threadPool);
|
webServer.setThreadPool(threadPool);
|
||||||
|
|
|
@ -18,9 +18,7 @@
|
||||||
package org.apache.hadoop.http;
|
package org.apache.hadoop.http;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.net.URLConnection;
|
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -131,7 +129,9 @@ public class TestHttpServer extends HttpServerFunctionalTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeClass public static void setup() throws Exception {
|
@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("echo", "/echo", EchoServlet.class);
|
||||||
server.addServlet("echomap", "/echomap", EchoMapServlet.class);
|
server.addServlet("echomap", "/echomap", EchoMapServlet.class);
|
||||||
server.addServlet("htmlcontent", "/htmlcontent", HtmlContentServlet.class);
|
server.addServlet("htmlcontent", "/htmlcontent", HtmlContentServlet.class);
|
||||||
|
@ -161,7 +161,8 @@ public class TestHttpServer extends HttpServerFunctionalTest {
|
||||||
assertEquals("a:b\nc:d\n",
|
assertEquals("a:b\nc:d\n",
|
||||||
readOutput(new URL(baseUrl, "/echo?a=b&c=d")));
|
readOutput(new URL(baseUrl, "/echo?a=b&c=d")));
|
||||||
int serverThreads = server.webServer.getThreadPool().getThreads();
|
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 +
|
System.out.println("Number of threads = " + serverThreads +
|
||||||
" which is less or equal than the max = " + MAX_THREADS);
|
" which is less or equal than the max = " + MAX_THREADS);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in New Issue