Skip to content

Commit

Permalink
changed util function to classloader only, fixed test style and error…
Browse files Browse the repository at this point in the history
… msg
  • Loading branch information
NiharS committed Sep 10, 2018
1 parent cf30ed5 commit 447c5e5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
5 changes: 1 addition & 4 deletions core/src/main/scala/org/apache/spark/executor/Executor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,7 @@ private[spark] class Executor(
plugin.shutdown()
} catch {
case e: Exception =>
logWarning(
s"""Plugin ${plugin.getClass().getCanonicalName()} failed to shutdown:
|${e.toString}
|${e.getStackTrace().mkString("\n")}""".stripMargin)
logWarning("Plugin " + plugin.getClass().getCanonicalName() + " shutdown failed", e)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/org/apache/spark/util/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ private[spark] object Utils extends Logging {
* Run a segment of code using a different context class loader in the current thread
*/
def withContextClassLoader[T](ctxClassLoader: ClassLoader)(fn: => T): T = {
val oldClassLoader = getContextOrSparkClassLoader
val oldClassLoader = Thread.currentThread().getContextClassLoader()
try {
Thread.currentThread().setContextClassLoader(ctxClassLoader)
fn
Expand Down
3 changes: 1 addition & 2 deletions core/src/test/java/org/apache/spark/ExecutorPluginSuite.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,11 @@ public void testPluginClassDoesNotExist() {
SparkConf conf = initializeSparkConf("nonexistant.plugin");
try {
sc = new JavaSparkContext(conf);
fail("No exception thrown for nonexistant plugin");
} catch (Exception e) {
// We cannot catch ClassNotFoundException directly because Java doesn't think it'll be thrown
assertTrue(e.toString().startsWith("java.lang.ClassNotFoundException"));
return;
}
fail("No exception thrown for nonexistant plugin");
}

@Test
Expand Down

0 comments on commit 447c5e5

Please sign in to comment.