Github user velvia commented on a diff in the pull request:
https://github.com/apache/spark/pull/119#discussion_r11217320
--- Diff: core/src/main/scala/org/apache/spark/SparkContext.scala ---
@@ -130,6 +130,18 @@ class SparkContext(
val isLocal = (master == "local" || master.startsWith("local["))
+ // Create a classLoader for use by the driver so that jars added via
addJar are available to the
+ // driver. Do this before all other initialization so that any thread
pools created for this
+ // SparkContext uses the class loader.
+ // In the future it might make sense to expose this to users so they can
assign it as the
+ // context class loader for other threads.
+ // Note that this is config-enabled as classloaders can introduce subtle
side effects
+ private[spark] val classLoader = if
(conf.getBoolean("spark.driver.loadAddedJars", false)) {
+ val loader = new SparkURLClassLoader(Array.empty[URL],
this.getClass.getClassLoader)
--- End diff --
By the way, I'm pretty sure there is almost no way that Spark contexts can
work properly inside of some server environment, with simply using Thread
context classloaders. The reason is that Spark spins up so many other threads.
To make everything work easier, I believe we should instead have a standard
classloader set in SparkEnv or somewhere like that, which can inherit from
Thread context in the thread that started SparkContext, but which can be used
everywhere else that spins up new threads.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---