=str #24298 ActorMaterializer now starts actors under /system unless

inside ActorContext, in which case it still is child actors as usual

This makes sense as they're "internal", so more like system actors
anyway, but the major reason for the change is Akka Typed, in which we
do not control the user guardian, and as such can not attach things
from the side into it
This commit is contained in:
Konrad Malawski 2018-01-22 21:51:49 +09:00 committed by Patrik Nordwall
parent cbe0215c41
commit dd62071ff8
4 changed files with 65 additions and 23 deletions

View file

@ -6,7 +6,7 @@ package akka.stream
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicBoolean
import akka.actor.{ ActorContext, ActorRef, ActorRefFactory, ActorSystem, ExtendedActorSystem, Props }
import akka.actor.{ ActorContext, ActorRef, ActorRefFactory, ActorSystem, ActorSystemImpl, ExtendedActorSystem, Props }
import akka.event.LoggingAdapter
import akka.util.Helpers.toRootLowerCase
import akka.stream.impl._
@ -60,11 +60,20 @@ object ActorMaterializer {
system,
materializerSettings,
system.dispatchers,
context.actorOf(StreamSupervisor.props(materializerSettings, haveShutDown).withDispatcher(materializerSettings.dispatcher), StreamSupervisor.nextName()),
actorOfStreamSupervisor(materializerSettings, context, haveShutDown),
haveShutDown,
FlowNames(system).name.copy(namePrefix))
}
private def actorOfStreamSupervisor(materializerSettings: ActorMaterializerSettings, context: ActorRefFactory, haveShutDown: AtomicBoolean) =
context match {
case s: ExtendedActorSystem
s.systemActorOf(StreamSupervisor.props(materializerSettings, haveShutDown).withDispatcher(materializerSettings.dispatcher), StreamSupervisor.nextName())
case a: ActorContext
a.actorOf(StreamSupervisor.props(materializerSettings, haveShutDown).withDispatcher(materializerSettings.dispatcher), StreamSupervisor.nextName())
}
/**
* Scala API: * Scala API: Creates an ActorMaterializer that can materialize stream blueprints as running streams.
*