Document and fix getAsyncCallback thread safety issues #27999

This commit is contained in:
Johan Andrén 2019-11-22 13:38:06 +01:00 committed by GitHub
parent 897443da40
commit 61bd3d42b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 57 additions and 35 deletions

View file

@ -1407,14 +1407,12 @@ private[stream] object Collect {
new GraphStageLogic(shape) with InHandler with OutHandler with StageLogging {
override protected def logSource: Class[_] = classOf[Watch[_]]
private lazy val self = getStageActor {
case (_, Terminated(`targetRef`)) =>
failStage(new WatchedActorTerminatedException("Watch", targetRef))
case (_, _) => // keep the compiler happy (stage actor receive is total)
}
override def preStart(): Unit = {
// initialize self, and watch the target
val self = getStageActor {
case (_, Terminated(`targetRef`)) =>
failStage(new WatchedActorTerminatedException("Watch", targetRef))
case (_, _) => // keep the compiler happy (stage actor receive is total)
}
self.watch(targetRef)
}