SOLR-6208: JettySolrRunner QueuedThreadPool's configuration code is never executed

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1610408 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2014-07-14 13:35:13 +00:00
parent b9a05a7938
commit 7ece5859b3
2 changed files with 18 additions and 30 deletions

View File

@ -171,6 +171,8 @@ Bug Fixes
* SOLR-6235: Leader initiated recovery should use coreNodeName instead of coreName to avoid marking
all replicas having common core name as down. (shalin)
* SOLR-6208: JettySolrRunner QueuedThreadPool's configuration code is never executed. (dweiss via shalin)
Optimizations
---------------------

View File

@ -25,6 +25,7 @@ import java.util.LinkedList;
import java.util.Random;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import javax.servlet.DispatcherType;
@ -228,7 +229,6 @@ public class JettySolrRunner {
sslInit(useSsl, sslcontext);
final Connector connector;
final QueuedThreadPool threadPool;
if ("SelectChannel".equals(connectorName)) {
final SelectChannelConnector c = useSsl
? new SslSelectChannelConnector(sslcontext)
@ -237,7 +237,6 @@ public class JettySolrRunner {
c.setLowResourcesMaxIdleTime(1500);
c.setSoLingerTime(0);
connector = c;
threadPool = (QueuedThreadPool) c.getThreadPool();
} else if ("Socket".equals(connectorName)) {
final SocketConnector c = useSsl
? new SslSocketConnector(sslcontext)
@ -245,44 +244,31 @@ public class JettySolrRunner {
c.setReuseAddress(true);
c.setSoLingerTime(0);
connector = c;
threadPool = (QueuedThreadPool) c.getThreadPool();
} else {
throw new IllegalArgumentException("Illegal value for system property 'tests.jettyConnector': " + connectorName);
}
connector.setPort(port);
connector.setHost("127.0.0.1");
if (threadPool != null) {
threadPool.setMaxThreads(10000);
threadPool.setMaxIdleTimeMs(5000);
threadPool.setMaxStopTimeMs(30000);
}
// Connectors by default inherit server's thread pool.
QueuedThreadPool qtp = new QueuedThreadPool();
qtp.setMaxThreads(10000);
qtp.setMaxIdleTimeMs((int) TimeUnit.SECONDS.toMillis(5));
qtp.setMaxStopTimeMs((int) TimeUnit.MINUTES.toMillis(1));
server.setThreadPool(qtp);
server.setConnectors(new Connector[] {connector});
server.setSessionIdManager(new HashSessionIdManager(new Random()));
} else {
for (Connector connector : server.getConnectors()) {
QueuedThreadPool threadPool = null;
if (connector instanceof SocketConnector) {
threadPool = (QueuedThreadPool) ((SocketConnector) connector)
.getThreadPool();
if (server.getThreadPool() == null) {
// Connectors by default inherit server's thread pool.
QueuedThreadPool qtp = new QueuedThreadPool();
qtp.setMaxThreads(10000);
qtp.setMaxIdleTimeMs((int) TimeUnit.SECONDS.toMillis(5));
qtp.setMaxStopTimeMs((int) TimeUnit.SECONDS.toMillis(1));
server.setThreadPool(qtp);
}
if (connector instanceof SelectChannelConnector) {
threadPool = (QueuedThreadPool) ((SelectChannelConnector) connector)
.getThreadPool();
}
if (threadPool != null) {
threadPool.setMaxThreads(10000);
threadPool.setMaxIdleTimeMs(5000);
if (!stopAtShutdown) {
threadPool.setMaxStopTimeMs(100);
}
}
}
}
// Initialize the servlets