diff options
author | Matei Zaharia <matei@eecs.berkeley.edu> | 2010-10-15 19:04:18 -0700 |
---|---|---|
committer | Matei Zaharia <matei@eecs.berkeley.edu> | 2010-10-15 19:04:18 -0700 |
commit | ecb1af576e5e0be9f67cf0375f998d1fa7ac3a07 (patch) | |
tree | 99137fb91c62950bdcc281e22d4b5b7819a2a7ac | |
parent | a768cf417b642fc3690ba03331f05d49c08d7a12 (diff) | |
download | spark-ecb1af576e5e0be9f67cf0375f998d1fa7ac3a07.tar.gz spark-ecb1af576e5e0be9f67cf0375f998d1fa7ac3a07.tar.bz2 spark-ecb1af576e5e0be9f67cf0375f998d1fa7ac3a07.zip |
Moved ClassServer out of repl packaged and renamed it to HttpServer.
-rw-r--r-- | src/scala/spark/HttpServer.scala (renamed from src/scala/spark/repl/ClassServer.scala) | 18 | ||||
-rw-r--r-- | src/scala/spark/repl/SparkInterpreter.scala | 6 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/scala/spark/repl/ClassServer.scala b/src/scala/spark/HttpServer.scala index 6a40d92765..55fb0a2218 100644 --- a/src/scala/spark/repl/ClassServer.scala +++ b/src/scala/spark/HttpServer.scala @@ -1,4 +1,4 @@ -package spark.repl +package spark import java.io.File import java.net.InetAddress @@ -8,22 +8,20 @@ import org.eclipse.jetty.server.handler.DefaultHandler import org.eclipse.jetty.server.handler.HandlerList import org.eclipse.jetty.server.handler.ResourceHandler -import spark.Logging - /** - * Exception type thrown by ClassServer when it is in the wrong state + * Exception type thrown by HttpServer when it is in the wrong state * for an operation. */ class ServerStateException(message: String) extends Exception(message) /** - * An HTTP server used by the interpreter to allow worker nodes to access - * class files created as the user types in lines of code. This is just a - * wrapper around a Jetty embedded HTTP server. + * An HTTP server for static content used to allow worker nodes to access JARs + * added to SparkContext as well as classes created by the interpreter when + * the user types in code. This is just a wrapper around a Jetty server. */ -class ClassServer(classDir: File) extends Logging { +class HttpServer(resourceBase: File) extends Logging { private var server: Server = null private var port: Int = -1 @@ -33,13 +31,13 @@ class ClassServer(classDir: File) extends Logging { } else { server = new Server(0) val resHandler = new ResourceHandler - resHandler.setResourceBase(classDir.getAbsolutePath) + resHandler.setResourceBase(resourceBase.getAbsolutePath) val handlerList = new HandlerList handlerList.setHandlers(Array(resHandler, new DefaultHandler)) server.setHandler(handlerList) server.start() port = server.getConnectors()(0).getLocalPort() - logDebug("ClassServer started at " + uri) + logDebug("HttpServer started at " + uri) } } diff --git a/src/scala/spark/repl/SparkInterpreter.scala b/src/scala/spark/repl/SparkInterpreter.scala index ae2e7e8a68..41324333a3 100644 --- a/src/scala/spark/repl/SparkInterpreter.scala +++ b/src/scala/spark/repl/SparkInterpreter.scala @@ -36,6 +36,8 @@ import scala.tools.nsc.{ InterpreterResults => IR } import interpreter._ import SparkInterpreter._ +import spark.HttpServer + /** <p> * An interpreter for Scala code. * </p> @@ -120,14 +122,14 @@ class SparkInterpreter(val settings: Settings, out: PrintWriter) { val virtualDirectory = new PlainFile(outputDir) /** Jetty server that will serve our classes to worker nodes */ - val classServer = new ClassServer(outputDir) + val classServer = new HttpServer(outputDir) // Start the classServer and store its URI in a spark system property // (which will be passed to executors so that they can connect to it) classServer.start() System.setProperty("spark.repl.class.uri", classServer.uri) if (SPARK_DEBUG_REPL) { - println("ClassServer started, URI = " + classServer.uri) + println("Class server started, URI = " + classServer.uri) } /** reporter */ |