Skip to content

Commit

Permalink
More feedback from Jetty
Browse files Browse the repository at this point in the history
Use a QTP with the defaults and call setName() instead

Uses a unique name per pool so you can identify the various
pools/servers
  • Loading branch information
jtnord committed Jan 20, 2020
1 parent 830184e commit 5bdfd1e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.util.security.Password;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.webapp.WebXmlConfiguration;
Expand Down Expand Up @@ -504,7 +505,9 @@ public void setPluginManager(PluginManager pluginManager) {
* that we need for testing.
*/
protected ServletContext createWebServer() throws Exception {
server = new Server();
QueuedThreadPool qtp = new QueuedThreadPool();
qtp.setName("Jetty Thread Pool (HudsonTestCase)");
server = new Server(qtp);

explodedWarDir = WarExploder.getExplodedDir();
WebAppContext context = new WebAppContext(explodedWarDir.getPath(), contextPath);
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/org/jvnet/hudson/test/JavaNetReverseProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;

import org.eclipse.jetty.util.thread.QueuedThreadPool;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
Expand All @@ -34,8 +34,9 @@ public class JavaNetReverseProxy extends HttpServlet {
public JavaNetReverseProxy(File cacheFolder) throws Exception {
this.cacheFolder = cacheFolder;
cacheFolder.mkdirs();

server = new Server();
QueuedThreadPool qtp = new QueuedThreadPool();
qtp.setName("Jetty Thread Pool (JavaNetReverseProxy)");
server = new Server(qtp);

ContextHandlerCollection contexts = new ContextHandlerCollection();
server.setHandler(contexts);
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/jvnet/hudson/test/JenkinsRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.util.security.Password;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.webapp.WebXmlConfiguration;
Expand Down Expand Up @@ -733,7 +734,9 @@ public static ImmutablePair<Server, ServletContext> _createWebServer(String cont
ClassLoader classLoader, int localPort,
Supplier<LoginService> loginServiceSupplier)
throws Exception {
Server server = new Server();
QueuedThreadPool qtp = new QueuedThreadPool();
qtp.setName("Jetty Thread Pool (JenkinsRule)");
Server server = new Server(qtp);

WebAppContext context = new WebAppContext(WarExploder.getExplodedDir().getPath(), contextPath);
context.setClassLoader(classLoader);
Expand Down

0 comments on commit 5bdfd1e

Please sign in to comment.