Skip to content

Commit

Permalink
Make port in HttpServer configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
ash211 committed Jul 25, 2014
1 parent 14174ab commit 1c0981a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions core/src/main/scala/org/apache/spark/HttpServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ private[spark] class ServerStateException(message: String) extends Exception(mes
* as well as classes created by the interpreter when the user types in code. This is just a wrapper
* around a Jetty server.
*/
private[spark] class HttpServer(resourceBase: File, securityManager: SecurityManager)
extends Logging {
private[spark] class HttpServer(resourceBase: File,
securityManager: SecurityManager,
localPort: Int = 0) extends Logging {
private var server: Server = null
private var port: Int = -1
private var port: Int = localPort

def start() {
if (server != null) {
Expand All @@ -55,7 +56,7 @@ private[spark] class HttpServer(resourceBase: File, securityManager: SecurityMan
val connector = new SocketConnector
connector.setMaxIdleTime(60*1000)
connector.setSoLingerTime(-1)
connector.setPort(0)
connector.setPort(localPort)
server.addConnector(connector)

val threadPool = new QueuedThreadPool
Expand Down

0 comments on commit 1c0981a

Please sign in to comment.