runzhiwang commented on a change in pull request #235: [LIVY-666] Support named 
interpreter groups
URL: https://github.com/apache/incubator-livy/pull/235#discussion_r332293406
 
 

 ##########
 File path: 
repl/scala-2.11/src/main/scala/org/apache/livy/repl/SparkInterpreter.scala
 ##########
 @@ -45,16 +46,22 @@ class SparkInterpreter(protected override val conf: 
SparkConf) extends AbstractS
     require(sparkILoop == null)
 
     val rootDir = conf.get("spark.repl.classdir", 
System.getProperty("java.io.tmpdir"))
-    val outputDir = Files.createTempDirectory(Paths.get(rootDir), 
"spark").toFile
-    outputDir.deleteOnExit()
-    conf.set("spark.repl.class.outputDir", outputDir.getAbsolutePath)
+    SparkInterpreter.sharedInterpreterLock.synchronized {
+      if (SparkInterpreter.outputDir == null) {
+        SparkInterpreter.outputDir = 
Files.createTempDirectory(Paths.get(rootDir), "spark").toFile
+        SparkInterpreter.outputDir.deleteOnExit()
+      }
+    }
 
+    val outputDir = SparkInterpreter.outputDir
     val settings = new Settings()
+    conf.set("spark.repl.class.outputDir", outputDir.getAbsolutePath)
     settings.processArguments(List("-Yrepl-class-based",
       "-Yrepl-outdir", s"${outputDir.getAbsolutePath}"), true)
     settings.usejavacp.value = true
     settings.embeddedDefaults(Thread.currentThread().getContextClassLoader())
 
+    System.setProperty("scala.repl.name.line", 
"$line"+this.hashCode().toString());
 
 Review comment:
   why set scala.repl.name.line?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to