#21743: FlattenMerge should propagate outer attributes

Added Materializer.materialize() version that takes explicit initial attributes
This commit is contained in:
drewhk 2016-11-09 20:14:04 +01:00 committed by Johan Andrén
parent 4dd969c0ae
commit 91b522e186
5 changed files with 68 additions and 7 deletions

View file

@ -39,6 +39,14 @@ abstract class ExtendedActorMaterializer extends ActorMaterializer {
_runnableGraph: Graph[ClosedShape, Mat],
subflowFuser: GraphInterpreterShell ActorRef): Mat
/**
* INTERNAL API
*/
def materialize[Mat](
_runnableGraph: Graph[ClosedShape, Mat],
subflowFuser: GraphInterpreterShell ActorRef,
initialAttributes: Attributes): Mat
/**
* INTERNAL API
*/
@ -109,7 +117,7 @@ private[akka] case class ActorMaterializerImpl(
private[this] def createFlowName(): String = flowNames.next()
private val initialAttributes = Attributes(
private val defaultInitialAttributes = Attributes(
Attributes.InputBuffer(settings.initialInputBufferSize, settings.maxInputBufferSize) ::
ActorAttributes.Dispatcher(settings.dispatcher) ::
ActorAttributes.SupervisionStrategy(settings.supervisionDecider) ::
@ -135,11 +143,19 @@ private[akka] case class ActorMaterializerImpl(
system.scheduler.scheduleOnce(delay, task)(executionContext)
override def materialize[Mat](_runnableGraph: Graph[ClosedShape, Mat]): Mat =
materialize(_runnableGraph, null)
materialize(_runnableGraph, null, defaultInitialAttributes)
override def materialize[Mat](_runnableGraph: Graph[ClosedShape, Mat], initialAttributes: Attributes): Mat =
materialize(_runnableGraph, null, initialAttributes)
override def materialize[Mat](_runnableGraph: Graph[ClosedShape, Mat], subflowFuser: (GraphInterpreterShell) ActorRef): Mat =
materialize(_runnableGraph, subflowFuser, defaultInitialAttributes)
override def materialize[Mat](
_runnableGraph: Graph[ClosedShape, Mat],
subflowFuser: GraphInterpreterShell ActorRef): Mat = {
_runnableGraph: Graph[ClosedShape, Mat],
subflowFuser: GraphInterpreterShell ActorRef,
initialAttributes: Attributes
): Mat = {
val runnableGraph =
if (settings.autoFusing) Fusing.aggressive(_runnableGraph)
else _runnableGraph
@ -255,6 +271,9 @@ private[akka] class SubFusingActorMaterializerImpl(val delegate: ExtendedActorMa
override def materialize[Mat](runnable: Graph[ClosedShape, Mat]): Mat = delegate.materialize(runnable, registerShell)
override def materialize[Mat](runnable: Graph[ClosedShape, Mat], initialAttributes: Attributes): Mat =
delegate.materialize(runnable, registerShell, initialAttributes)
override def scheduleOnce(delay: FiniteDuration, task: Runnable): Cancellable = delegate.scheduleOnce(delay, task)
override def schedulePeriodically(initialDelay: FiniteDuration, interval: FiniteDuration, task: Runnable): Cancellable =