SOLR-4839: Avoid NPE when jetty.testMode=false

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1657495 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2015-02-05 08:42:56 +00:00
parent 118a826378
commit 93ba7da65f
1 changed files with 10 additions and 23 deletions

View File

@ -148,10 +148,6 @@ public class JettySolrRunner {
}
}
public JettySolrRunner(String solrHome, String context, int port) {
this.init(solrHome, context, port, true);
this.name = "jetty-" + JETTY_ID_COUNTER.incrementAndGet();
@ -218,11 +214,19 @@ public class JettySolrRunner {
private void init(String solrHome, String context, int port, boolean stopAtShutdown) {
this.context = context;
this.solrHome = solrHome;
this.stopAtShutdown = stopAtShutdown;
System.setProperty("solr.solr.home", solrHome);
QueuedThreadPool qtp = new QueuedThreadPool();
qtp.setMaxThreads(10000);
qtp.setIdleTimeout((int) TimeUnit.SECONDS.toMillis(5));
qtp.setStopTimeout((int) TimeUnit.MINUTES.toMillis(1));
server = new Server(qtp);
server.manage(qtp);
server.setStopAtShutdown(stopAtShutdown);
if (System.getProperty("jetty.testMode") != null) {
// if this property is true, then jetty will be configured to use SSL
// leveraging the same system properties as java to specify
@ -237,15 +241,6 @@ public class JettySolrRunner {
final SslContextFactory sslcontext = new SslContextFactory(false);
sslInit(useSsl, sslcontext);
QueuedThreadPool qtp = new QueuedThreadPool();
qtp.setMaxThreads(10000);
qtp.setIdleTimeout((int) TimeUnit.SECONDS.toMillis(5));
qtp.setStopTimeout((int) TimeUnit.MINUTES.toMillis(1));
server = new Server(qtp);
server.setStopAtShutdown(stopAtShutdown);
server.manage(qtp);
ServerConnector connector;
if (useSsl) {
HttpConfiguration configuration = new HttpConfiguration();
@ -273,15 +268,7 @@ public class JettySolrRunner {
} else {
ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory());
connector.setPort(port);
QueuedThreadPool qtp = new QueuedThreadPool();
qtp.setMaxThreads(10000);
qtp.setIdleTimeout((int) TimeUnit.SECONDS.toMillis(5));
qtp.setStopTimeout((int) TimeUnit.SECONDS.toMillis(1));
server = new Server(qtp);
server.setStopAtShutdown(stopAtShutdown);
server.manage(qtp);
server.setConnectors(new Connector[] {connector});
}
// Initialize the servlets