@@ -176,7 +176,7 @@ class ChannelUndeliveredElementStressTest(private val kind: TestChannelKind) : T
176
176
177
177
private suspend fun stopSender () {
178
178
stoppedSender++
179
- sender.cancel ()
179
+ sender.cancelAndJoin ()
180
180
senderDone.receive()
181
181
}
182
182
@@ -224,7 +224,7 @@ class ChannelUndeliveredElementStressTest(private val kind: TestChannelKind) : T
224
224
private val firstFailedToDeliverOrReceivedCallTrace = atomic<Exception ?>(null )
225
225
226
226
fun failedToDeliver () {
227
- val trace = if (TRACING_ENABLED ) Exception (" First onUndeliveredElement() call" ) else DUMMY_TRACING_EXCEPTION
227
+ val trace = if (TRACING_ENABLED ) Exception (" First onUndeliveredElement() call" ) else DUMMY_TRACE_EXCEPTION
228
228
if (firstFailedToDeliverOrReceivedCallTrace.compareAndSet(null , trace)) {
229
229
failedToDeliverCnt.incrementAndGet()
230
230
failedStatus[x] = 1
@@ -234,7 +234,7 @@ class ChannelUndeliveredElementStressTest(private val kind: TestChannelKind) : T
234
234
}
235
235
236
236
fun onReceived () {
237
- val trace = if (TRACING_ENABLED ) Exception (" First onReceived() call" ) else DUMMY_TRACING_EXCEPTION
237
+ val trace = if (TRACING_ENABLED ) Exception (" First onReceived() call" ) else DUMMY_TRACE_EXCEPTION
238
238
if (firstFailedToDeliverOrReceivedCallTrace.compareAndSet(null , trace)) return
239
239
throw IllegalStateException (" onUndeliveredElement()/onReceived() notified twice" , firstFailedToDeliverOrReceivedCallTrace.value!! )
240
240
}
@@ -265,5 +265,5 @@ class ChannelUndeliveredElementStressTest(private val kind: TestChannelKind) : T
265
265
}
266
266
}
267
267
268
- private const val TRACING_ENABLED = false // Change to `true` to enable tracing while
269
- private val DUMMY_TRACING_EXCEPTION = Exception (" The tracing is disabled; please enable it by changing the `TRACING_ENABLED` constant to `true`." )
268
+ private const val TRACING_ENABLED = false // Change to `true` to enable the tracing
269
+ private val DUMMY_TRACE_EXCEPTION = Exception (" The tracing is disabled; please enable it by changing the `TRACING_ENABLED` constant to `true`." )
0 commit comments