Skip to content

Commit fe970a7

Browse files
author
Marcelo Vanzin
committed
Review feedback.
1 parent 25d4fed commit fe970a7

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

core/src/main/scala/org/apache/spark/executor/CoarseGrainedExecutorBackend.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ private[spark] object CoarseGrainedExecutorBackend extends Logging {
217217
| --hostname <hostname>
218218
| --cores <cores>
219219
| --app-id <appid>
220-
| [--worker-url <workerUrl>]
221-
| [--user-class-path <url>]
220+
| --worker-url <workerUrl>
221+
| --user-class-path <url>
222222
|""".stripMargin)
223223
System.exit(1)
224224
}

core/src/main/scala/org/apache/spark/executor/ExecutorURLClassLoader.scala

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,27 @@ import org.apache.spark.util.ParentClassLoader
2929
* The addURL method in URLClassLoader is protected. We subclass it to make this accessible.
3030
* We also make changes so user classes can come before the default classes.
3131
*/
32-
3332
private[spark] trait MutableURLClassLoader extends ClassLoader {
3433
def addURL(url: URL)
3534
def getURLs: Array[URL]
3635
}
3736

37+
/**
38+
* A class loader that gives preference to its own URLs over the parent class loader
39+
* when loading classes and resources.
40+
*/
3841
private[spark] class ChildExecutorURLClassLoader(urls: Array[URL], parent: ClassLoader)
3942
extends URLClassLoader(urls, null) with MutableURLClassLoader {
4043

4144
private val parentClassLoader = new ParentClassLoader(parent)
45+
46+
/**
47+
* Used to implement fine-grained class loading locks similar to what is done by Java 7. This
48+
* prevents deadlock issues when using non-hierarchical class loaders.
49+
*
50+
* Note that due to Java 6 compatibility (and some issues with implementing class loaders in
51+
* Scala), Java 7's `ClassLoader.registerAsParallelCapable` method is not called.
52+
*/
4253
private val locks = new ConcurrentHashMap[String, Object]()
4354

4455
override def loadClass(name: String, resolve: Boolean): Class[_] = {
@@ -84,6 +95,9 @@ private[spark] class ChildExecutorURLClassLoader(urls: Array[URL], parent: Class
8495

8596
}
8697

98+
/**
99+
* A MutableURLClassLoader that follows the standard parent-first hierarchy.
100+
*/
87101
private[spark] class ExecutorURLClassLoader(urls: Array[URL], parent: ClassLoader)
88102
extends URLClassLoader(urls, parent) with MutableURLClassLoader {
89103

0 commit comments

Comments
 (0)