Github user zsxwing commented on a diff in the pull request: https://github.com/apache/spark/pull/8781#discussion_r39733547 --- Diff: core/src/test/scala/org/apache/spark/util/ThreadUtilsSuite.scala --- @@ -66,4 +66,25 @@ class ThreadUtilsSuite extends SparkFunSuite { val futureThreadName = Await.result(f, 10.seconds) assert(futureThreadName === callerThreadName) } + + test("runInNewThread") { + import ThreadUtils._ + assert(runInNewThread("thread-name") { Thread.currentThread().getName } === "thread-name") + assert(runInNewThread("thread-name") { Thread.currentThread().isDaemon } === true) + assert( + runInNewThread("thread-name", isDaemon = false) { Thread.currentThread().isDaemon } === false + ) + val exception = intercept[Exception] { + runInNewThread("thread-name") { throw new IllegalArgumentException("test") } + } + assert(exception.isInstanceOf[IllegalArgumentException]) + assert(exception.asInstanceOf[IllegalArgumentException].getMessage.contains("test")) --- End diff -- You can update these 3 lines to: ``` val exception = intercept[IllegalArgumentException] { runInNewThread("thread-name") { throw new IllegalArgumentException("test") } } assert(exception.getMessage.contains("test")) ```
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org