aboutsummaryrefslogtreecommitdiff
path: root/kvision-server/src/main/kotlin/pl/treksoft
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-09-28 13:08:57 +0200
committerRobert Jaros <rjaros@finn.pl>2018-09-28 13:08:57 +0200
commit1c021517808829418ac9bc8443e6b2653c869812 (patch)
treef9b626f24a2969f669ab2d939b6cd31a0d063d32 /kvision-server/src/main/kotlin/pl/treksoft
parenta3bfbe7f072217288c14e3f2c734bb5918564c33 (diff)
downloadkvision-1c021517808829418ac9bc8443e6b2653c869812.tar.gz
kvision-1c021517808829418ac9bc8443e6b2653c869812.tar.bz2
kvision-1c021517808829418ac9bc8443e6b2653c869812.zip
Migration to Kotlin 1.3
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