Skip to content

Commit

Permalink
Almost works
Browse files Browse the repository at this point in the history
  • Loading branch information
holdenk committed Apr 8, 2014
1 parent 16aecd1 commit 792d961
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,34 @@ private[spark] class ExecutorURLClassLoader(urls: Array[URL], parent: ClassLoade
}
val userClassLoader = new OverridenURLClassLoader(urls, null)

object childClassLoader extends ClassLoader(parent) {
class ParentClassLoader(myParent: ClassLoader) extends ClassLoader(parent) {
override def findClass(name: String): Class[_] = {
println("parent class loader quest")
super.findClass(name)
}
}
val parentClassLoader = new ParentClassLoader(parent)

override def findClass(name: String): Class[_] = {
println("looking for "+name)
if (!userFirst) {
try {
childClassLoader.findClass(name)
println("loooking in parent")
val c = parentClassLoader.findClass(name)
println("found in parent")
c
} catch {
case e: ClassNotFoundException => userClassLoader.findClass(name)
case e: ClassNotFoundException => {
println("could not find in parent")
userClassLoader.findClass(name)
}
}
} else {
try {
userClassLoader.findClass(name)
} catch {
case e: ClassNotFoundException => {
childClassLoader.findClass(name)
parentClassLoader.findClass(name)
}
}
}
Expand Down
Binary file modified core/src/test/resources/fake-spark-class.jar
Binary file not shown.

0 comments on commit 792d961

Please sign in to comment.