aboutsummaryrefslogtreecommitdiffstats
path: root/kotlinx-coroutines-core/jvm/test/channels/ChannelSendReceiveStressTest.kt
diff options
context:
space:
mode:
Diffstat (limited to 'kotlinx-coroutines-core/jvm/test/channels/ChannelSendReceiveStressTest.kt')
-rw-r--r--kotlinx-coroutines-core/jvm/test/channels/ChannelSendReceiveStressTest.kt16
1 files changed, 8 insertions, 8 deletions
diff --git a/kotlinx-coroutines-core/jvm/test/channels/ChannelSendReceiveStressTest.kt b/kotlinx-coroutines-core/jvm/test/channels/ChannelSendReceiveStressTest.kt
index f414c333..a6345cc5 100644
--- a/kotlinx-coroutines-core/jvm/test/channels/ChannelSendReceiveStressTest.kt
+++ b/kotlinx-coroutines-core/jvm/test/channels/ChannelSendReceiveStressTest.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
+ * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
package kotlinx.coroutines.channels
@@ -60,10 +60,10 @@ class ChannelSendReceiveStressTest(
launch(pool + CoroutineName("receiver$receiverIndex")) {
when (receiverIndex % 5) {
0 -> doReceive(receiverIndex)
- 1 -> doReceiveOrNull(receiverIndex)
+ 1 -> doReceiveCatching(receiverIndex)
2 -> doIterator(receiverIndex)
3 -> doReceiveSelect(receiverIndex)
- 4 -> doReceiveSelectOrNull(receiverIndex)
+ 4 -> doReceiveCatchingSelect(receiverIndex)
}
receiversCompleted.incrementAndGet()
}
@@ -152,9 +152,9 @@ class ChannelSendReceiveStressTest(
}
}
- private suspend fun doReceiveOrNull(receiverIndex: Int) {
+ private suspend fun doReceiveCatching(receiverIndex: Int) {
while (true) {
- doReceived(receiverIndex, channel.receiveOrNull() ?: break)
+ doReceived(receiverIndex, channel.receiveCatching().getOrNull() ?: break)
}
}
@@ -173,10 +173,10 @@ class ChannelSendReceiveStressTest(
}
}
- private suspend fun doReceiveSelectOrNull(receiverIndex: Int) {
+ private suspend fun doReceiveCatchingSelect(receiverIndex: Int) {
while (true) {
- val event = select<Int?> { channel.onReceiveOrNull { it } } ?: break
+ val event = select<Int?> { channel.onReceiveCatching { it.getOrNull() } } ?: break
doReceived(receiverIndex, event)
}
}
-} \ No newline at end of file
+}