Use ExecutionContext.parasitic for Scala 2.13, #26655"
* scala.concurrent.Future$InternalCallbackExecutor$ doesn't exist in Scala 2.13 * also changed the fallback to use sameThreadExecutionContext since they seems to be identical
This commit is contained in:
parent
a82992b1b4
commit
ca6d0f8c22
2 changed files with 12 additions and 8 deletions
|
|
@ -19,6 +19,7 @@ import com.typesafe.config.{ Config, ConfigFactory }
|
|||
import scala.concurrent.duration._
|
||||
import scala.concurrent.{ Await, ExecutionContext, Future }
|
||||
import scala.language.postfixOps
|
||||
import scala.util.Properties
|
||||
|
||||
object ActorSystemSpec {
|
||||
|
||||
|
|
@ -130,9 +131,13 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend
|
|||
|
||||
"An ActorSystem" must {
|
||||
|
||||
"use scala.concurrent.Future's InternalCallbackEC" in {
|
||||
system.asInstanceOf[ActorSystemImpl].internalCallingThreadExecutionContext.getClass.getName should ===(
|
||||
"scala.concurrent.Future$InternalCallbackExecutor$")
|
||||
"use scala.concurrent InternalCallbackExecutor/parasitic" in {
|
||||
val ec = system.asInstanceOf[ActorSystemImpl].internalCallingThreadExecutionContext
|
||||
val scalaVersion = Properties.versionNumberString
|
||||
if (scalaVersion.startsWith("2.13") && scalaVersion != "2.13.0-M5")
|
||||
ec.getClass.getName should ===("scala.concurrent.ExecutionContext$parasitic$")
|
||||
else
|
||||
ec.getClass.getName should ===("scala.concurrent.Future$InternalCallbackExecutor$")
|
||||
}
|
||||
|
||||
"reject invalid names" in {
|
||||
|
|
|
|||
|
|
@ -847,11 +847,10 @@ private[akka] class ActorSystemImpl(
|
|||
val internalCallingThreadExecutionContext: ExecutionContext =
|
||||
dynamicAccess
|
||||
.getObjectFor[ExecutionContext]("scala.concurrent.Future$InternalCallbackExecutor$")
|
||||
.getOrElse(new ExecutionContext with BatchingExecutor {
|
||||
override protected def unbatchedExecute(r: Runnable): Unit = r.run()
|
||||
override protected def resubmitOnBlock: Boolean = false // Since we execute inline, no gain in resubmitting
|
||||
override def reportFailure(t: Throwable): Unit = dispatcher.reportFailure(t)
|
||||
})
|
||||
.getOrElse(
|
||||
dynamicAccess
|
||||
.getObjectFor[ExecutionContext]("scala.concurrent.ExecutionContext$parasitic$")
|
||||
.getOrElse(ExecutionContexts.sameThreadExecutionContext))
|
||||
|
||||
private[this] final val terminationCallbacks = new TerminationCallbacks(provider.terminationFuture)(dispatcher)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue