From 5864cbcbfe2eb8c36ca05c3a39c7e5916aeecaec Mon Sep 17 00:00:00 2001 From: Dante Niewenhuis Date: Tue, 5 Mar 2024 13:23:57 +0100 Subject: Updated package versions, updated web server tests. (#207) * Updated all package versions including kotlin. Updated all web-server tests to run. * Changed the java version of the tests. OpenDC now only supports java 19. * small update * test update * new update * updated docker version to 19 * updated docker version to 19 --- .../opendc/common/DispatcherCoroutineDispatcher.kt | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'opendc-common/src/main/kotlin') diff --git a/opendc-common/src/main/kotlin/org/opendc/common/DispatcherCoroutineDispatcher.kt b/opendc-common/src/main/kotlin/org/opendc/common/DispatcherCoroutineDispatcher.kt index 63744ef9..d33e370d 100644 --- a/opendc-common/src/main/kotlin/org/opendc/common/DispatcherCoroutineDispatcher.kt +++ b/opendc-common/src/main/kotlin/org/opendc/common/DispatcherCoroutineDispatcher.kt @@ -37,20 +37,33 @@ import kotlin.coroutines.CoroutineContext */ @OptIn(InternalCoroutinesApi::class) internal class DispatcherCoroutineDispatcher(private val dispatcher: Dispatcher) : CoroutineDispatcher(), Delay, DispatcherProvider { - override fun dispatch(context: CoroutineContext, block: Runnable) { + override fun dispatch( + context: CoroutineContext, + block: Runnable, + ) { block.run() } - override fun dispatchYield(context: CoroutineContext, block: Runnable) { + override fun dispatchYield( + context: CoroutineContext, + block: Runnable, + ) { dispatcher.schedule(block) } @OptIn(ExperimentalCoroutinesApi::class) - override fun scheduleResumeAfterDelay(timeMillis: Long, continuation: CancellableContinuation) { + override fun scheduleResumeAfterDelay( + timeMillis: Long, + continuation: CancellableContinuation, + ) { dispatcher.schedule(timeMillis, CancellableContinuationRunnable(continuation) { resumeUndispatched(Unit) }) } - override fun invokeOnTimeout(timeMillis: Long, block: Runnable, context: CoroutineContext): DisposableHandle { + override fun invokeOnTimeout( + timeMillis: Long, + block: Runnable, + context: CoroutineContext, + ): DisposableHandle { val handle = dispatcher.scheduleCancellable(timeMillis, block) return DisposableHandle { handle.cancel() } } @@ -67,7 +80,7 @@ internal class DispatcherCoroutineDispatcher(private val dispatcher: Dispatcher) */ private class CancellableContinuationRunnable( @JvmField val continuation: CancellableContinuation, - private val block: CancellableContinuation.() -> Unit + private val block: CancellableContinuation.() -> Unit, ) : Runnable { override fun run() = continuation.block() } -- cgit v1.2.3