File tree Expand file tree Collapse file tree 7 files changed +30
-13
lines changed
main/kotlin/kotlinx/coroutines/experimental
kotlinx-coroutines-javafx/src/test/kotlin/examples
kotlinx-coroutines-jdk8/src/test/kotlin/examples
kotlinx-coroutines-nio/src/test/kotlin/examples
kotlinx-coroutines-swing/src/test/kotlin/examples Expand file tree Collapse file tree 7 files changed +30
-13
lines changed Original file line number Diff line number Diff line change 1414
1515 <name >Kotlin coroutines core library</name >
1616
17+ <properties >
18+ <kotlin .compiler.jdkHome>${env.JDK_16} </kotlin .compiler.jdkHome>
19+ </properties >
20+
1721 <build >
1822 <sourceDirectory >src/main/kotlin</sourceDirectory >
1923 <testSourceDirectory >src/test/kotlin</testSourceDirectory >
24+
25+ <plugins >
26+ <plugin >
27+ <artifactId >maven-surefire-plugin</artifactId >
28+ <configuration >
29+ <forkMode >once</forkMode >
30+ <jvm >${env.JDK_16} /bin/java</jvm >
31+ </configuration >
32+ </plugin >
33+ </plugins >
2034 </build >
2135</project >
Original file line number Diff line number Diff line change @@ -2,15 +2,14 @@ package kotlinx.coroutines.experimental
22
33import java.util.concurrent.Executor
44import java.util.concurrent.Executors
5- import java.util.concurrent.ForkJoinPool
65import java.util.concurrent.atomic.AtomicInteger
76import kotlin.coroutines.CoroutineContext
87
98/* *
109 * Represents common pool of shared threads as coroutine dispatcher for compute-intensive tasks.
11- * It uses [ForkJoinPool] when available, which implements efficient work-stealing algorithm for its queues, so every
10+ * It uses [java.util.concurrent. ForkJoinPool] when available, which implements efficient work-stealing algorithm for its queues, so every
1211 * coroutine resumption is dispatched as a separate task even when it already executes inside the pool.
13- * When available, it wraps [ ForkJoinPool.commonPool] and provides a similar shared pool where not.
12+ * When available, it wraps ` ForkJoinPool.commonPool` and provides a similar shared pool where not.
1413 */
1514object CommonPool : CoroutineDispatcher() {
1615 private val pool: Executor = findPool()
Original file line number Diff line number Diff line change 11package examples
22
3- import java.time.Instant
3+ import java.text.SimpleDateFormat
4+ import java.util.*
45
5- fun log (msg : String ) = println (" ${Instant .now( )} [${Thread .currentThread().name} ] $msg " )
6+ fun log (msg : String ) = println (" ${SimpleDateFormat ( " YYYYMMdd-HHmmss.sss " ).format( Date () )} [${Thread .currentThread().name} ] $msg " )
Original file line number Diff line number Diff line change @@ -15,14 +15,14 @@ import kotlinx.coroutines.experimental.Job
1515import kotlinx.coroutines.experimental.delay
1616import kotlinx.coroutines.experimental.javafx.JavaFx
1717import kotlinx.coroutines.experimental.launch
18- import java.time.Instant
18+ import java.text.SimpleDateFormat
1919import java.util.*
2020
2121fun main (args : Array <String >) {
2222 Application .launch(FxTestApp ::class .java, * args)
2323}
2424
25- fun log (msg : String ) = println (" ${Instant .now( )} [${Thread .currentThread().name} ] $msg " )
25+ fun log (msg : String ) = println (" ${SimpleDateFormat ( " YYYYMMdd-HHmmss.sss " ).format( Date () )} [${Thread .currentThread().name} ] $msg " )
2626
2727class FxTestApp : Application () {
2828 val buttons = FlowPane ().apply {
Original file line number Diff line number Diff line change 11package examples
22
3- import java.time.Instant
3+ import java.text.SimpleDateFormat
4+ import java.util.*
45
5- fun log (msg : String ) = println (" ${Instant .now( )} [${Thread .currentThread().name} ] $msg " )
6+ fun log (msg : String ) = println (" ${SimpleDateFormat ( " YYYYMMdd-HHmmss.sss " ).format( Date () )} [${Thread .currentThread().name} ] $msg " )
Original file line number Diff line number Diff line change 11package examples
22
3- import java.time.Instant
3+ import java.text.SimpleDateFormat
4+ import java.util.*
45
5- fun log (msg : String ) = println (" ${Instant .now( )} [${Thread .currentThread().name} ] $msg " )
6+ fun log (msg : String ) = println (" ${SimpleDateFormat ( " YYYYMMdd-HHmmss.sss " ).format( Date () )} [${Thread .currentThread().name} ] $msg " )
Original file line number Diff line number Diff line change @@ -2,11 +2,12 @@ package examples
22
33import kotlinx.coroutines.experimental.runBlocking
44import kotlinx.coroutines.experimental.swing.Swing
5- import java.time.Instant
5+ import java.text.SimpleDateFormat
6+ import java.util.*
67import java.util.concurrent.ForkJoinPool
78import kotlin.coroutines.suspendCoroutine
89
9- fun log (msg : String ) = println (" ${Instant .now( )} [${Thread .currentThread().name} ] $msg " )
10+ fun log (msg : String ) = println (" ${SimpleDateFormat ( " YYYYMMdd-HHmmss.sss " ).format( Date () )} [${Thread .currentThread().name} ] $msg " )
1011
1112suspend fun makeRequest (): String {
1213 log(" Making request..." )
You can’t perform that action at this time.
0 commit comments