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_r332299264
########## 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) Review comment: How about put this line before `val settings = new Settings()` ? ---------------------------------------------------------------- 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