=str: Materializer should report being shut down on sys termination
This commit is contained in:
parent
911943fc92
commit
292eba2d73
3 changed files with 19 additions and 6 deletions
|
|
@ -31,6 +31,7 @@ private[akka] case class ActorMaterializerImpl(
|
|||
override val settings: ActorMaterializerSettings,
|
||||
dispatchers: Dispatchers,
|
||||
val supervisor: ActorRef,
|
||||
val haveShutDown: AtomicBoolean,
|
||||
flowNameCounter: AtomicLong,
|
||||
namePrefix: String,
|
||||
optimizations: Optimizations)
|
||||
|
|
@ -38,8 +39,6 @@ private[akka] case class ActorMaterializerImpl(
|
|||
import ActorMaterializerImpl._
|
||||
import akka.stream.impl.Stages._
|
||||
|
||||
private val haveShutDown = new AtomicBoolean(false)
|
||||
|
||||
override def shutdown(): Unit =
|
||||
if (haveShutDown.compareAndSet(false, true)) supervisor ! PoisonPill
|
||||
|
||||
|
|
@ -255,7 +254,8 @@ private[akka] class FlowNameCounter extends Extension {
|
|||
* INTERNAL API
|
||||
*/
|
||||
private[akka] object StreamSupervisor {
|
||||
def props(settings: ActorMaterializerSettings): Props = Props(new StreamSupervisor(settings)).withDeploy(Deploy.local)
|
||||
def props(settings: ActorMaterializerSettings, haveShutDown: AtomicBoolean): Props =
|
||||
Props(new StreamSupervisor(settings, haveShutDown)).withDeploy(Deploy.local)
|
||||
|
||||
final case class Materialize(props: Props, name: String) extends DeadLetterSuppression with NoSerializationVerificationNeeded
|
||||
|
||||
|
|
@ -269,7 +269,7 @@ private[akka] object StreamSupervisor {
|
|||
final case object StoppedChildren
|
||||
}
|
||||
|
||||
private[akka] class StreamSupervisor(settings: ActorMaterializerSettings) extends Actor {
|
||||
private[akka] class StreamSupervisor(settings: ActorMaterializerSettings, haveShutDown: AtomicBoolean) extends Actor {
|
||||
import akka.stream.impl.StreamSupervisor._
|
||||
|
||||
override def supervisorStrategy = SupervisorStrategy.stoppingStrategy
|
||||
|
|
@ -283,6 +283,8 @@ private[akka] class StreamSupervisor(settings: ActorMaterializerSettings) extend
|
|||
context.children.foreach(context.stop)
|
||||
sender() ! StoppedChildren
|
||||
}
|
||||
|
||||
override def postStop(): Unit = haveShutDown.set(true)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue