SOLR-4189: Fix hanging threads on FreeBSD in JettySolrRunner by making connector configureable through sysprop, listen only on 127.0.0.1 in tests

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1422127 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2012-12-14 22:19:58 +00:00
parent 17569aa775
commit 6af24c8866
5 changed files with 32 additions and 5 deletions

View File

@ -154,6 +154,7 @@
<subant buildpath="." antfile="extra-targets.xml" target="-run-maven-build" inheritall="false" failonerror="true">
<propertyset>
<propertyref prefix="maven-"/>
<propertyref builtin="commandline"/>
</propertyset>
</subant>
</target>

View File

@ -99,6 +99,15 @@
<doctitle>${project.name} ${project.version} API (${now.version})</doctitle>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<tests.jettyConnector>${tests.jettyConnector}</tests.jettyConnector>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

View File

@ -56,6 +56,9 @@
mavenVersion="${maven-version}" failonerror="true" fork="true">
<arg value="-fae"/>
<arg value="install"/>
<syspropertyset>
<propertyref builtin="commandline"/>
</syspropertyset>
</mvn>
</target>

View File

@ -916,6 +916,7 @@
<propertyref prefix="tests.failfast" />
<propertyref prefix="tests.badapples" />
<propertyref prefix="tests.timeoutSuite" />
<propertyref prefix="tests.jettyConnector" />
</syspropertyset>
<!-- Pass randomized settings to the forked JVM. -->

View File

@ -154,12 +154,25 @@ public class JettySolrRunner {
}
System.setProperty("solr.solr.home", solrHome);
if (System.getProperty("jetty.testMode") != null) {
SelectChannelConnector connector = new SelectChannelConnector();
final String connectorName = System.getProperty("tests.jettyConnector", "SelectChannel");
final Connector connector;
final QueuedThreadPool threadPool;
if ("SelectChannel".equals(connectorName)) {
final SelectChannelConnector c = new SelectChannelConnector();
c.setReuseAddress(true);
c.setLowResourcesMaxIdleTime(1500);
connector = c;
threadPool = (QueuedThreadPool) c.getThreadPool();
} else if ("Socket".equals(connectorName)) {
final SocketConnector c = new SocketConnector();
c.setReuseAddress(true);
connector = c;
threadPool = (QueuedThreadPool) c.getThreadPool();
} else {
throw new IllegalArgumentException("Illegal value for system property 'tests.jettyConnector': " + connectorName);
}
connector.setPort(port);
connector.setReuseAddress(true);
connector.setLowResourcesMaxIdleTime(1500);
QueuedThreadPool threadPool = (QueuedThreadPool) connector
.getThreadPool();
connector.setHost("127.0.0.1");
if (threadPool != null) {
threadPool.setMaxThreads(10000);
threadPool.setMaxIdleTimeMs(5000);