Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Dropping APIs deprecated since 2.6
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.impl.fusing.ActorGraphInterpreter#BatchingActorInputBoundary.onDownstreamFinish")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.impl.fusing.PrefixAndTail#PrefixAndTailLogic.onDownstreamFinish")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.impl.io.ByteStringParser#ParsingLogic.onDownstreamFinish")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.scaladsl.MergeHub#MergedSourceLogic.onDownstreamFinish")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.AbstractInOutHandler.onDownstreamFinish")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.AbstractOutHandler.onDownstreamFinish")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.GraphStageLogic#ConditionalTerminateOutput.onDownstreamFinish")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.GraphStageLogic#EagerTerminateOutput.onDownstreamFinish")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.GraphStageLogic#Emitting.onDownstreamFinish")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.GraphStageLogic#IgnoreTerminateOutput.onDownstreamFinish")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.OutHandler.onDownstreamFinish")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.TimerGraphStageLogic.schedulePeriodicallyWithInitialDelay")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.TimerGraphStageLogic.schedulePeriodically")
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.TimerGraphStageLogic.schedulePeriodically")

#for scala 3.2
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.stream.stage.GraphStageLogic.lastCancellationCause_=")
89 changes: 1 addition & 88 deletions akka-stream/src/main/scala/akka/stream/stage/GraphStage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -683,13 +683,6 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount:
final def completeStage(): Unit =
internalCompleteStage(SubscriptionWithCancelException.StageWasCompleted, OptionVal.None)

// Variable used from `OutHandler.onDownstreamFinish` to carry over cancellation cause in cases where
// `OutHandler` implementations call `super.onDownstreamFinished()`.
/**
* INTERNAL API
*/
@InternalApi private[stream] var lastCancellationCause: Throwable = _

/**
* Automatically invokes [[cancel]] or [[complete]] on all the input or output ports that have been called,
* then marks the stage as stopped.
Expand Down Expand Up @@ -1770,66 +1763,6 @@ abstract class TimerGraphStageLogic(_shape: Shape) extends GraphStageLogic(_shap
scheduleAtFixedRate(timerKey, initialDelay.asScala, interval.asScala)
}

/**
* Schedule timer to call [[#onTimer]] periodically with the given interval after the specified
* initial delay.
* Any existing timer with the same key will automatically be canceled before
* adding the new timer.
*/
@deprecated(
"Use scheduleWithFixedDelay or scheduleAtFixedRate instead. This has the same semantics as " +
"scheduleAtFixedRate, but scheduleWithFixedDelay is often preferred.",
since = "2.6.0")
final protected def schedulePeriodicallyWithInitialDelay(
timerKey: Any,
initialDelay: FiniteDuration,
interval: FiniteDuration): Unit =
scheduleAtFixedRate(timerKey, initialDelay, interval)

/**
* Schedule timer to call [[#onTimer]] periodically with the given interval after the specified
* initial delay.
* Any existing timer with the same key will automatically be canceled before
* adding the new timer.
*/
@deprecated(
"Use scheduleWithFixedDelay or scheduleAtFixedRate instead. This has the same semantics as " +
"scheduleAtFixedRate, but scheduleWithFixedDelay is often preferred.",
since = "2.6.0")
final protected def schedulePeriodicallyWithInitialDelay(
timerKey: Any,
initialDelay: java.time.Duration,
interval: java.time.Duration): Unit = {
import akka.util.JavaDurationConverters._
schedulePeriodicallyWithInitialDelay(timerKey, initialDelay.asScala, interval.asScala)
}

/**
* Schedule timer to call [[#onTimer]] periodically with the given interval.
* Any existing timer with the same key will automatically be canceled before
* adding the new timer.
*/
@deprecated(
"Use scheduleWithFixedDelay or scheduleAtFixedRate instead. This has the same semantics as " +
"scheduleAtFixedRate, but scheduleWithFixedDelay is often preferred.",
since = "2.6.0")
final protected def schedulePeriodically(timerKey: Any, interval: FiniteDuration): Unit =
schedulePeriodicallyWithInitialDelay(timerKey, interval, interval)

/**
* Schedule timer to call [[#onTimer]] periodically with the given interval.
* Any existing timer with the same key will automatically be canceled before
* adding the new timer.
*/
@deprecated(
"Use scheduleWithFixedDelay or scheduleAtFixedRate instead. This has the same semantics as " +
"scheduleAtFixedRate, but scheduleWithFixedDelay is often preferred.",
since = "2.6.0")
final protected def schedulePeriodically(timerKey: Any, interval: java.time.Duration): Unit = {
import akka.util.JavaDurationConverters._
schedulePeriodically(timerKey, interval.asScala)
}

/**
* Cancel timer, ensuring that the [[#onTimer]] is not subsequently called.
*
Expand Down Expand Up @@ -1893,34 +1826,14 @@ trait OutHandler {
@throws(classOf[Exception])
def onPull(): Unit

/**
* Called when the output port will no longer accept any new elements. After this callback no other callbacks will
* be called for this port.
*/
@throws(classOf[Exception])
@deprecatedOverriding("Override `def onDownstreamFinish(cause: Throwable)`, instead.", since = "2.6.0") // warns when overriding
@deprecated("Call onDownstreamFinish with a cancellation cause.", since = "2.6.0") // warns when calling
def onDownstreamFinish(): Unit = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder if this has been fully migrated everywhere in Akka libraries? We might want to keep this for some longer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a problem.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only stream contrib among the repo mains as far as I can see, but still might be best to keep it around for some more time.

val thisStage = GraphInterpreter.currentInterpreter.activeStage
require(
thisStage.lastCancellationCause ne null,
"onDownstreamFinish() must not be called without a cancellation cause")
thisStage.cancelStage(thisStage.lastCancellationCause)
}

/**
* Called when the output port will no longer accept any new elements. After this callback no other callbacks will
* be called for this port.
*/
@throws(classOf[Exception])
def onDownstreamFinish(cause: Throwable): Unit = {
val thisStage = GraphInterpreter.currentInterpreter.activeStage
try {
require(cause ne null, "Cancellation cause must not be null")
require(thisStage.lastCancellationCause eq null, "onDownstreamFinish(cause) must not be called recursively")
thisStage.lastCancellationCause = cause
(onDownstreamFinish(): @nowarn("msg=deprecated")) // if not overridden, call old deprecated variant
} finally thisStage.lastCancellationCause = null
thisStage.cancelStage(cause)
}
}

Expand Down