diff options
author | Jungtaek Lim <kabhwan@gmail.com> | 2015-11-24 09:20:09 -0800 |
---|---|---|
committer | Marcelo Vanzin <vanzin@cloudera.com> | 2015-11-24 09:20:09 -0800 |
commit | be9dd1550c1816559d3d418a19c692e715f1c94e (patch) | |
tree | d52bbed62b10b46de1f89563c7d57b179db29f49 /repl/src/main | |
parent | 5889880fbe9628681042036892ef7ebd4f0857b4 (diff) | |
download | spark-be9dd1550c1816559d3d418a19c692e715f1c94e.tar.gz spark-be9dd1550c1816559d3d418a19c692e715f1c94e.tar.bz2 spark-be9dd1550c1816559d3d418a19c692e715f1c94e.zip |
[SPARK-11818][REPL] Fix ExecutorClassLoader to lookup resources from …
…parent class loader
Without patch, two additional tests of ExecutorClassLoaderSuite fails.
- "resource from parent"
- "resources from parent"
Detailed explanation is here, https://issues.apache.org/jira/browse/SPARK-11818?focusedCommentId=15011202&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15011202
Author: Jungtaek Lim <kabhwan@gmail.com>
Closes #9812 from HeartSaVioR/SPARK-11818.
Diffstat (limited to 'repl/src/main')
-rw-r--r-- | repl/src/main/scala/org/apache/spark/repl/ExecutorClassLoader.scala | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/repl/src/main/scala/org/apache/spark/repl/ExecutorClassLoader.scala b/repl/src/main/scala/org/apache/spark/repl/ExecutorClassLoader.scala index a976e96809..a8859fcd45 100644 --- a/repl/src/main/scala/org/apache/spark/repl/ExecutorClassLoader.scala +++ b/repl/src/main/scala/org/apache/spark/repl/ExecutorClassLoader.scala @@ -34,7 +34,9 @@ import org.apache.spark.util.ParentClassLoader /** * A ClassLoader that reads classes from a Hadoop FileSystem or HTTP URI, * used to load classes defined by the interpreter when the REPL is used. - * Allows the user to specify if user class path should be first + * Allows the user to specify if user class path should be first. + * This class loader delegates getting/finding resources to parent loader, + * which makes sense until REPL never provide resource dynamically. */ class ExecutorClassLoader(conf: SparkConf, classUri: String, parent: ClassLoader, userClassPathFirst: Boolean) extends ClassLoader with Logging { @@ -55,6 +57,14 @@ class ExecutorClassLoader(conf: SparkConf, classUri: String, parent: ClassLoader } } + override def getResource(name: String): URL = { + parentLoader.getResource(name) + } + + override def getResources(name: String): java.util.Enumeration[URL] = { + parentLoader.getResources(name) + } + override def findClass(name: String): Class[_] = { userClassPathFirst match { case true => findClassLocally(name).getOrElse(parentLoader.loadClass(name)) |