GrizzlyConnector patch for Jetty to work with QueuedThreadPool
May 2, 2009
This is a late night post, so I am just going to make it short. This patch lets you use QueuedThreadPool with the Grizzly Connector. This is a monkey patch, getMaxThreads() should be moved up into the Thread Interface.
--- GrizzlyConnection-old.java Sat May 2 01:08:02 2009
+++ GrizzlyConnector.java Sat May 2 00:56:37 2009
@@ -51,6 +51,8 @@
import org.mortbay.jetty.webapp.WebAppContext;
import org.mortbay.log.Log;
import org.mortbay.thread.BoundedThreadPool;
+import org.mortbay.thread.QueuedThreadPool;
+import org.mortbay.thread.ThreadPool;
/* ------------------------------------------------------------------------------- */
/**
@@ -178,8 +180,13 @@
controller.setProtocolChainInstanceHandler(instanceHandler);
Pipeline pipeline = new DefaultPipeline();
- pipeline.setMaxThreads(
- ((BoundedThreadPool)getServer().getThreadPool()).getMaxThreads());
+ if(getServer().getThreadPool() instanceof BoundedThreadPool) {
+ pipeline.setMaxThreads(
+ ((BoundedThreadPool)getServer().getThreadPool()).getMaxThreads());
+ } else {
+ pipeline.setMaxThreads(
+ ((QueuedThreadPool)getServer().getThreadPool()).getMaxThreads());
+ }
controller.setPipeline(pipeline);
}
which version of jetty is this applicable for?
according to http://permalink.gmane.org/gmane.comp.java.jetty.support/13685, jetty 6.1.19 already uses grizzly with queued thread pool