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.duration._
|
||||||
import scala.concurrent.{ Await, ExecutionContext, Future }
|
import scala.concurrent.{ Await, ExecutionContext, Future }
|
||||||
import scala.language.postfixOps
|
import scala.language.postfixOps
|
||||||
|
import scala.util.Properties
|
||||||
|
|
||||||
object ActorSystemSpec {
|
object ActorSystemSpec {
|
||||||
|
|
||||||
|
|
@ -130,9 +131,13 @@ class ActorSystemSpec extends AkkaSpec(ActorSystemSpec.config) with ImplicitSend
|
||||||
|
|
||||||
"An ActorSystem" must {
|
"An ActorSystem" must {
|
||||||
|
|
||||||
"use scala.concurrent.Future's InternalCallbackEC" in {
|
"use scala.concurrent InternalCallbackExecutor/parasitic" in {
|
||||||
system.asInstanceOf[ActorSystemImpl].internalCallingThreadExecutionContext.getClass.getName should ===(
|
val ec = system.asInstanceOf[ActorSystemImpl].internalCallingThreadExecutionContext
|
||||||
"scala.concurrent.Future$InternalCallbackExecutor$")
|
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 {
|
"reject invalid names" in {
|
||||||
|
|
|
||||||
|
|
@ -847,11 +847,10 @@ private[akka] class ActorSystemImpl(
|
||||||
val internalCallingThreadExecutionContext: ExecutionContext =
|
val internalCallingThreadExecutionContext: ExecutionContext =
|
||||||
dynamicAccess
|
dynamicAccess
|
||||||
.getObjectFor[ExecutionContext]("scala.concurrent.Future$InternalCallbackExecutor$")
|
.getObjectFor[ExecutionContext]("scala.concurrent.Future$InternalCallbackExecutor$")
|
||||||
.getOrElse(new ExecutionContext with BatchingExecutor {
|
.getOrElse(
|
||||||
override protected def unbatchedExecute(r: Runnable): Unit = r.run()
|
dynamicAccess
|
||||||
override protected def resubmitOnBlock: Boolean = false // Since we execute inline, no gain in resubmitting
|
.getObjectFor[ExecutionContext]("scala.concurrent.ExecutionContext$parasitic$")
|
||||||
override def reportFailure(t: Throwable): Unit = dispatcher.reportFailure(t)
|
.getOrElse(ExecutionContexts.sameThreadExecutionContext))
|
||||||
})
|
|
||||||
|
|
||||||
private[this] final val terminationCallbacks = new TerminationCallbacks(provider.terminationFuture)(dispatcher)
|
private[this] final val terminationCallbacks = new TerminationCallbacks(provider.terminationFuture)(dispatcher)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue