SOLR-2002: try setting SO_REUSEADDR during jetty tests to prevent failures for disconnect/reconnect tests

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1021969 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2010-10-13 01:01:52 +00:00
parent ccf58605e9
commit bba56f893d
6 changed files with 13 additions and 8 deletions

View File

@ -470,7 +470,7 @@
<sysproperty key="lucene.version" value="${dev.version}"/>
<sysproperty key="testmethod" value="${testmethod}"/>
<sysproperty key="jetty.insecurerandom" value="1"/>
<sysproperty key="jetty.testMode" value="1"/>
<formatter type="xml"/>
<formatter classname="${junit.details.formatter}" usefile="false"/>

View File

@ -435,7 +435,7 @@
<sysproperty key="tests.multiplier" value="${tests.multiplier}"/>
<sysproperty key="tests.iter" value="${tests.iter}"/>
<sysproperty key="tests.seed" value="${tests.seed}"/>
<sysproperty key="jetty.insecurerandom" value="1"/>
<sysproperty key="jetty.testMode" value="1"/>
<sysproperty key="tempDir" file="@{tempDir}/@{threadNum}"/>
<sysproperty key="testmethod" value="${testmethod}"/>
<!-- TODO: why is this unconditionally set to "" above? disable for now

View File

@ -116,7 +116,7 @@
<sysproperty key="tests.multiplier" value="${tests.multiplier}"/>
<sysproperty key="tests.seed" value="${tests.seed}"/>
<sysproperty key="tests.iter" value="${tests.iter}"/>
<sysproperty key="jetty.insecurerandom" value="1"/>
<sysproperty key="jetty.testMode" value="1"/>
<sysproperty key="tempDir" file="${junit.output.dir}"/>
<sysproperty key="testmethod" value="${testmethod}"/>
<jvmarg line="${args}"/>

View File

@ -168,7 +168,7 @@
<sysproperty key="tests.multiplier" value="${tests.multiplier}"/>
<sysproperty key="tests.iter" value="${tests.iter}"/>
<sysproperty key="tests.seed" value="${tests.seed}"/>
<sysproperty key="jetty.insecurerandom" value="1"/>
<sysproperty key="jetty.testMode" value="1"/>
<sysproperty key="tempDir" file="${tempDir}"/>
<sysproperty key="testmethod" value="${testmethod}"/>
<jvmarg line="${args}"/>
@ -226,7 +226,7 @@
<sysproperty key="tests.multiplier" value="${tests.multiplier}"/>
<sysproperty key="tests.iter" value="${tests.iter}"/>
<sysproperty key="tests.seed" value="${tests.seed}"/>
<sysproperty key="jetty.insecurerandom" value="1"/>
<sysproperty key="jetty.testMode" value="1"/>
<sysproperty key="tempDir" file="${tempDir}"/>
<sysproperty key="testmethod" value="${testmethod}"/>
<jvmarg line="${args}"/>

View File

@ -117,7 +117,7 @@
<sysproperty key="tests.multiplier" value="${tests.multiplier}"/>
<sysproperty key="tests.iter" value="${tests.iter}"/>
<sysproperty key="tests.seed" value="${tests.seed}"/>
<sysproperty key="jetty.insecurerandom" value="1"/>
<sysproperty key="jetty.testMode" value="1"/>
<sysproperty key="tempDir" file="${tempDir}"/>
<sysproperty key="testmethod" value="${testmethod}"/>
<jvmarg line="${args}"/>

View File

@ -30,6 +30,7 @@ import org.apache.solr.servlet.SolrDispatchFilter;
import org.mortbay.jetty.Handler;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.FilterHolder;
import org.mortbay.jetty.servlet.HashSessionIdManager;
@ -77,9 +78,13 @@ public class JettySolrRunner
{
this.context = context;
server = new Server( port );
if (System.getProperty("jetty.insecurerandom") != null)
if (System.getProperty("jetty.testMode") != null) {
SelectChannelConnector connector = new SelectChannelConnector();
connector.setPort(port);
connector.setReuseAddress(true);
server.setConnectors(new Connector[] { connector });
server.setSessionIdManager(new HashSessionIdManager(new Random()));
}
server.setStopAtShutdown( true );
// Initialize the servlets