Propagate stream cancellation causes (#27266)

* base functionality
* fix-restart-flow
* Fix subSource / subSink cancellation handling
* GraphStage-fix
* Fix ambiguity between complete and cancellation (for isAvailable / grab)
* rename lastCancellationCause
* add mima
* fix cancellation cause propagation in OutputBoundary
* Fix cancellation cause propagation in SubSink
* Add cancellation cause logging to Flow.log
* add more comments about GraphStage portState internals
* Add some assertions in onDownstreamFinish to prevent wrong usage
* Also deprecate onDownstreamFinish() so that no one calls the wrong one
accidentally
* add SubSinkInlet.cancel(cause)
* Propagate causes in two other places
* Suggest to use `cancel(in, cause)` but don't deprecate old one
This commit is contained in:
Johannes Rudolph 2019-08-16 10:53:14 +02:00 committed by Patrik Nordwall
parent 6c13949aec
commit 16033eaf5e
17 changed files with 210 additions and 96 deletions

View file

@ -1505,11 +1505,16 @@ private[stream] object Collect {
super.onUpstreamFinish()
}
override def onDownstreamFinish(): Unit = {
override def onDownstreamFinish(cause: Throwable): Unit = {
if (isEnabled(logLevels.onFinish))
log.log(logLevels.onFinish, "[{}] Downstream finished.", name)
log.log(
logLevels.onFinish,
"[{}] Downstream finished, cause: {}: {}",
name,
Logging.simpleName(cause.getClass),
cause.getMessage)
super.onDownstreamFinish()
super.onDownstreamFinish(cause: Throwable)
}
private def isEnabled(l: LogLevel): Boolean = l.asInt != OffInt
@ -2150,9 +2155,9 @@ private[stream] object Collect {
super.onUpstreamFailure(ex)
}
override def onDownstreamFinish(): Unit = {
override def onDownstreamFinish(cause: Throwable): Unit = {
matPromise.success(None)
super.onDownstreamFinish()
super.onDownstreamFinish(cause)
}
override def onPull(): Unit = {