Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert ExecutionContext.global to not be a BatchingExecutor #9270

Merged
merged 1 commit into from Oct 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 2 additions & 10 deletions src/library/scala/concurrent/impl/ExecutionContextImpl.scala
Expand Up @@ -14,7 +14,7 @@ package scala.concurrent.impl

import java.util.concurrent.{ Semaphore, ForkJoinPool, ForkJoinWorkerThread, Callable, Executor, ExecutorService, ThreadFactory, TimeUnit }
import java.util.Collection
import scala.concurrent.{ Batchable, BatchingExecutor, BlockContext, ExecutionContext, CanAwait, ExecutionContextExecutor, ExecutionContextExecutorService }
import scala.concurrent.{ BlockContext, ExecutionContext, CanAwait, ExecutionContextExecutor, ExecutionContextExecutorService }

private[scala] class ExecutionContextImpl private[impl] (final val executor: Executor, final val reporter: Throwable => Unit) extends ExecutionContextExecutor {
require(executor ne null, "Executor must not be null")
Expand Down Expand Up @@ -98,15 +98,7 @@ private[concurrent] object ExecutionContextImpl {
prefix = "scala-execution-context-global",
uncaught = (thread: Thread, cause: Throwable) => reporter(cause))

new ForkJoinPool(desiredParallelism, threadFactory, threadFactory.uncaught, true) with ExecutionContextExecutorService with BatchingExecutor {
final override def submitForExecution(runnable: Runnable): Unit = super[ForkJoinPool].execute(runnable)

final override def execute(runnable: Runnable): Unit =
if ((!runnable.isInstanceOf[Promise.Transformation[_,_]] || runnable.asInstanceOf[Promise.Transformation[_,_]].benefitsFromBatching) && runnable.isInstanceOf[Batchable])
submitAsyncBatched(runnable)
else
submitForExecution(runnable)

new ForkJoinPool(desiredParallelism, threadFactory, threadFactory.uncaught, true) with ExecutionContextExecutorService {
final override def reportFailure(cause: Throwable): Unit =
getUncaughtExceptionHandler() match {
case null =>
Expand Down