aboutsummaryrefslogtreecommitdiff
path: root/kvision-server/src/main/kotlin/pl/treksoft
diff options
context:
space:
mode:
Diffstat (limited to 'kvision-server/src/main/kotlin/pl/treksoft')
-rw-r--r--kvision-server/src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt13
-rw-r--r--kvision-server/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt4
2 files changed, 9 insertions, 8 deletions
diff --git a/kvision-server/src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt b/kvision-server/src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt
index 57fe1c36..928892a2 100644
--- a/kvision-server/src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt
+++ b/kvision-server/src/main/kotlin/pl/treksoft/kvision/remote/Jooby.kt
@@ -24,13 +24,14 @@
package pl.treksoft.kvision.remote
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
-import kotlinx.coroutines.experimental.Deferred
-import kotlinx.coroutines.experimental.Unconfined
+import kotlinx.coroutines.Deferred
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.GlobalScope
import org.jooby.Kooby
import org.jooby.Session
import org.jooby.json.Jackson
import org.pac4j.core.profile.CommonProfile
-import kotlinx.coroutines.experimental.async as coroutinesAsync
+import kotlinx.coroutines.async as coroutinesAsync
/**
* A Jooby based server.
@@ -63,7 +64,7 @@ actual typealias Profile = CommonProfile
* A helper extension function for asynchronous request processing.
*/
fun <RESP> Request?.async(block: (Request) -> RESP): Deferred<RESP> = this?.let { req ->
- coroutinesAsync(Unconfined) {
+ GlobalScope.coroutinesAsync(Dispatchers.Unconfined) {
block(req)
}
} ?: throw IllegalStateException("Request not set!")
@@ -73,7 +74,7 @@ fun <RESP> Request?.async(block: (Request) -> RESP): Deferred<RESP> = this?.let
*/
fun <RESP> Request?.async(block: (Request, Session) -> RESP): Deferred<RESP> = this?.let { req ->
val session = req.session()
- coroutinesAsync(Unconfined) {
+ GlobalScope.coroutinesAsync(Dispatchers.Unconfined) {
block(req, session)
}
} ?: throw IllegalStateException("Request not set!")
@@ -84,7 +85,7 @@ fun <RESP> Request?.async(block: (Request, Session) -> RESP): Deferred<RESP> = t
fun <RESP> Request?.async(block: (Request, Session, Profile) -> RESP): Deferred<RESP> = this?.let { req ->
val session = req.session()
val profile = req.require(CommonProfile::class.java)
- coroutinesAsync(Unconfined) {
+ GlobalScope.coroutinesAsync(Dispatchers.Unconfined) {
block(req, session, profile)
}
} ?: throw IllegalStateException("Request not set!")
diff --git a/kvision-server/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt b/kvision-server/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt
index 0ff01d04..edaa9ba3 100644
--- a/kvision-server/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt
+++ b/kvision-server/src/main/kotlin/pl/treksoft/kvision/remote/ServiceManager.kt
@@ -22,8 +22,8 @@
package pl.treksoft.kvision.remote
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
-import kotlinx.coroutines.experimental.Deferred
-import kotlinx.coroutines.experimental.runBlocking
+import kotlinx.coroutines.Deferred
+import kotlinx.coroutines.runBlocking
import org.jooby.Response
import org.jooby.Status
import org.slf4j.Logger