mirror of
https://github.com/corda/corda.git
synced 2025-01-27 14:49:35 +00:00
CORDA-3309: Install UncaughtExceptionHandler for DJVM tasks. (#88)
This commit is contained in:
parent
ecc5ace4c7
commit
90c2f7f129
@ -91,7 +91,7 @@ abstract class TestBase(type: SandboxType) {
|
|||||||
action: SandboxRuntimeContext.() -> Unit
|
action: SandboxRuntimeContext.() -> Unit
|
||||||
) {
|
) {
|
||||||
var thrownException: Throwable? = null
|
var thrownException: Throwable? = null
|
||||||
thread {
|
thread(start = false) {
|
||||||
try {
|
try {
|
||||||
UserPathSource(classPaths).use { userSource ->
|
UserPathSource(classPaths).use { userSource ->
|
||||||
SandboxRuntimeContext(parentConfiguration.createChild(userSource, Consumer {
|
SandboxRuntimeContext(parentConfiguration.createChild(userSource, Consumer {
|
||||||
@ -105,7 +105,13 @@ abstract class TestBase(type: SandboxType) {
|
|||||||
} catch (exception: Throwable) {
|
} catch (exception: Throwable) {
|
||||||
thrownException = exception
|
thrownException = exception
|
||||||
}
|
}
|
||||||
}.join()
|
}.apply {
|
||||||
|
uncaughtExceptionHandler = Thread.UncaughtExceptionHandler { _, ex ->
|
||||||
|
thrownException = ex
|
||||||
|
}
|
||||||
|
start()
|
||||||
|
join()
|
||||||
|
}
|
||||||
throw thrownException ?: return
|
throw thrownException ?: return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user