@@ -337,10 +337,10 @@ private[spark] object JettyUtils extends Logging {
337337 val securePort = sslOptions.createJettySslContextFactory().map { factory =>
338338 val securePort = sslOptions.port.getOrElse(if (port > 0 ) Utils .userPort(port, 400 ) else 0 )
339339 val secureServerName = if (serverName.nonEmpty) s " $serverName (HTTPS) " else serverName
340+ val connectionFactories = AbstractConnectionFactory .getFactories(factory,
341+ new HttpConnectionFactory ())
340342
341343 def sslConnect (currentPort : Int ): (ServerConnector , Int ) = {
342- val connectionFactories = AbstractConnectionFactory .getFactories(factory,
343- new HttpConnectionFactory ())
344344 newConnector(connectionFactories, currentPort)
345345 }
346346
@@ -365,14 +365,15 @@ private[spark] object JettyUtils extends Logging {
365365 redirector.start()
366366 }
367367
368- // Add all the known handlers and install the connectors.
368+ server.addConnector(httpConnector)
369+
370+ // Add all the known handlers now that connectors are configured.
369371 handlers.foreach { h =>
370372 val gzipHandler = new GzipHandler ()
371373 gzipHandler.setHandler(h)
372374 collection.addHandler(gzipHandler)
373375 gzipHandler.start()
374376 }
375- server.addConnector(httpConnector)
376377
377378 pool.setMaxThreads(math.max(pool.getMaxThreads, minThreads))
378379 ServerInfo (server, httpPort, securePort, collection)
0 commit comments