Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/8781#discussion_r39881817
--- Diff: core/src/test/scala/org/apache/spark/util/ThreadUtilsSuite.scala
---
@@ -66,4 +66,24 @@ 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[IllegalArgumentException] {
+ runInNewThread("thread-name") { throw new
IllegalArgumentException("test") }
--- End diff --
can you add some kind of more unique identifier here? I wouldn't be
surprised if elsewhere we have `test` in the stack trace. Maybe just do
`"test-" + System.currentTimeMillis`
---
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.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]