summaryrefslogtreecommitdiff
path: root/odcsim/odcsim-engine-omega/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2020-03-24 22:04:06 +0100
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-03-25 10:51:28 +0100
commit225a9dd042870b1320681104aa022120611cc92b (patch)
tree08a18803589bd034ff18e0a02588af9febe24005 /odcsim/odcsim-engine-omega/src
parentedce7993772182bac0d0c74d22189137b35872aa (diff)
feat: Record hypervisor events during experiment
Diffstat (limited to 'odcsim/odcsim-engine-omega/src')
-rw-r--r--odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/OmegaSimulationEngine.kt7
1 files changed, 6 insertions, 1 deletions
diff --git a/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/OmegaSimulationEngine.kt b/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/OmegaSimulationEngine.kt
index 4edf94d2..934af293 100644
--- a/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/OmegaSimulationEngine.kt
+++ b/odcsim/odcsim-engine-omega/src/main/kotlin/com/atlarge/odcsim/engine/omega/OmegaSimulationEngine.kt
@@ -37,6 +37,7 @@ import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.coroutineContext
import kotlinx.coroutines.CancellableContinuation
import kotlinx.coroutines.CoroutineDispatcher
+import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.Delay
import kotlinx.coroutines.DisposableHandle
@@ -174,6 +175,10 @@ public class OmegaSimulationEngine(override val name: String) : SimulationEngine
}
}
+ private val exceptionHandler = CoroutineExceptionHandler { _, exception ->
+ log.error("Uncaught exception", exception)
+ }
+
// SimulationContext
override val key: CoroutineContext.Key<*> = SimulationContext.Key
@@ -192,7 +197,7 @@ public class OmegaSimulationEngine(override val name: String) : SimulationEngine
override val parent: Domain = parent ?: this
@InternalCoroutinesApi
- override val coroutineContext: CoroutineContext = this + CoroutineName(name) + dispatcher + job
+ override val coroutineContext: CoroutineContext = this + CoroutineName(name) + dispatcher + job + exceptionHandler
override fun toString(): String = path
}