elizarov
09/28/2017, 8:20 AMelizarov
09/28/2017, 8:20 AMinline
from runOnThread
it works just finePaul Woitaschek
09/28/2017, 8:29 AMelizarov
09/28/2017, 8:33 AMPaul Woitaschek
09/28/2017, 8:38 AMgeekasm
09/28/2017, 9:09 AMgeekasm
09/28/2017, 9:09 AMgeekasm
09/28/2017, 9:09 AMgeekasm
09/28/2017, 9:10 AMgeekasm
09/28/2017, 9:10 AMelizarov
09/28/2017, 9:20 AMn
).
2. Define your own context for SQL operations like this: val SQL = newFixedThreadPoolContext(n, "SQL")
3. Wrap your SQL operations into run(SQL) { ... }
invocation. It works best if you ecapsulate them in suspending functions like this:
suspend fun mySqlOperation(params) = run(SQL) { .... }
Now you can use those suspending functions from coroutines and it will not block anything.geekasm
09/28/2017, 10:39 AMdave08
09/28/2017, 11:26 AMsuspend
that contain a suspendable function usually complain that you can't run a suspendable function there, in measureTimeMillis { }
lambda, no complaint...!?kirillrakhman
09/28/2017, 11:28 AMdave08
09/28/2017, 11:29 AMdave08
09/28/2017, 12:34 PMorg.mockito.exceptions.misusing.InvalidUseOfMatchersException:
Invalid use of argument matchers!
2 matchers expected, 1 recorded:
-> at com.....SyncServiceSpec$1$3$2$5$1.doResume(SyncServiceSpec.kt:162)
This exception may occur if matchers are combined with raw values:
//incorrect:
someMethod(anyObject(), "raw String");
When using matchers, all arguments have to be provided by matchers.
For example:
//correct:
someMethod(anyObject(), eq("String by matcher"));
Since Mockito expects that all params should use matchers,dave08
09/28/2017, 12:35 PMjanvladimirmostert
09/28/2017, 12:35 PMelizarov
09/28/2017, 12:35 PMelizarov
09/28/2017, 12:37 PMjanvladimirmostert
09/28/2017, 12:38 PMdave08
09/28/2017, 12:39 PMtestCompile 'org.mockito:mockito-core:2.5.0'
testCompile ('com.nhaarman:mockito-kotlin-kt1.1:1.5.0') {
exclude group: 'org.jetbrains.kotlin'
}
elizarov
09/28/2017, 12:41 PMelizarov
09/28/2017, 12:42 PMjanvladimirmostert
09/28/2017, 12:42 PMelizarov
09/28/2017, 12:44 PMjanvladimirmostert
09/28/2017, 12:46 PMDávid Karnok
09/28/2017, 10:26 PMelizarov
09/29/2017, 8:46 PMkotlinx.coroutines
version 0.19 is released. It is now published to Maven Central. DefaultDispatcher
is introduced, so launch { ... }
and async { ... }
can be used w/o parameters. Parent coroutines now wait for their children. The full list of changes in here: https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.mdbj0
09/29/2017, 8:55 PM