Skip to content

Commit a490165

Browse files
committed
~ Chnaged fallback to Dispatchers.IO
1 parent 703b99a commit a490165

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kotlinx-coroutines-core/jvm/src/Executors.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public abstract class ExecutorCoroutineDispatcher: CoroutineDispatcher(), Closea
4141
*
4242
* Note, that if the underlying executor uses limited queues and throws [RejectedExecutionException] on
4343
* attempt to submit a task, then the [Job] of the affected task is [cancelled][Job.cancel] and the
44-
* task is submitted to the default single-threaded executor, so that the affected coroutine can cleanup its
44+
* task is submitted to the [Dispatchers.IO], so that the affected coroutine can cleanup its
4545
* resources and promptly complete.
4646
*/
4747
@JvmName("from") // this is for a nice Java API, see issue #255
@@ -53,7 +53,7 @@ public fun ExecutorService.asCoroutineDispatcher(): ExecutorCoroutineDispatcher
5353
*
5454
* Note, that if the underlying executor uses limited queues and throws [RejectedExecutionException] on
5555
* attempt to submit a task, then the [Job] of the affected task is [cancelled][Job.cancel] and the
56-
* task is submitted to the default single-threaded executor, so that the affected coroutine can cleanup its
56+
* task is submitted to the [Dispatchers.IO], so that the affected coroutine can cleanup its
5757
* resources and promptly complete.
5858
*/
5959
@JvmName("from") // this is for a nice Java API, see issue #255
@@ -93,7 +93,7 @@ internal abstract class ExecutorCoroutineDispatcherBase : ExecutorCoroutineDispa
9393
} catch (e: RejectedExecutionException) {
9494
unTrackTask()
9595
cancelJobOnRejection(context, e)
96-
DefaultExecutor.enqueue(block)
96+
Dispatchers.IO.dispatch(context, block)
9797
}
9898
}
9999

0 commit comments

Comments
 (0)