diff --git a/libraries/pom.xml b/libraries/pom.xml index a200fe8350..80ec0edfea 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -117,6 +117,26 @@ commons-io ${commons.io.version} + + org.eclipse.jetty + jetty-server + ${jetty.version} + + + org.eclipse.jetty + jetty-servlet + ${jetty.version} + + + org.apache.httpcomponents + httpclient + ${httpclient.version} + + + commons-io + commons-io + ${commons.io.version} + org.apache.flink flink-core @@ -144,6 +164,9 @@ 3.6.2 1.5.0 3.1.0 + 9.4.3.v20170317 + 4.5.3 + 2.5 9.4.2.v20170220 4.5.3 2.5 diff --git a/libraries/src/main/java/com/baeldung/jetty/JettyServer.java b/libraries/src/main/java/com/baeldung/jetty/JettyServer.java index 1365de866a..1033a7266d 100644 --- a/libraries/src/main/java/com/baeldung/jetty/JettyServer.java +++ b/libraries/src/main/java/com/baeldung/jetty/JettyServer.java @@ -4,6 +4,7 @@ import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.servlet.ServletHandler; +import org.eclipse.jetty.util.thread.QueuedThreadPool; public class JettyServer { @@ -11,7 +12,13 @@ public class JettyServer { public void start() throws Exception { - server = new Server(); + int maxThreads = 100; + int minThreads = 10; + int idleTimeout = 120; + + QueuedThreadPool threadPool = new QueuedThreadPool(maxThreads, minThreads, idleTimeout); + + server = new Server(threadPool); ServerConnector connector = new ServerConnector(server); connector.setPort(8090); server.setConnectors(new Connector[]{connector});