Skip to content

Commit

Permalink
chore: Remove SupervisedGraphStageLogic
Browse files Browse the repository at this point in the history
  • Loading branch information
He-Pin committed Dec 21, 2024
1 parent 7184dad commit dac6c73
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.stream.impl.fusing.SupervisedGraphStageLogic")
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import scala.util.control.Exception.Catcher

import org.apache.pekko
import pekko.actor.{ ActorRef, Terminated }
import pekko.annotation.{ DoNotInherit, InternalApi }
import pekko.annotation.InternalApi
import pekko.event._
import pekko.event.Logging.LogLevel
import pekko.stream.{ Supervision, _ }
Expand Down Expand Up @@ -206,33 +206,6 @@ import pekko.util.ccompat._
override def toString = "DropWhile"
}

/**
* INTERNAL API
*/
@DoNotInherit private[pekko] abstract class SupervisedGraphStageLogic(inheritedAttributes: Attributes, shape: Shape)
extends GraphStageLogic(shape) {
private lazy val decider = inheritedAttributes.mandatoryAttribute[SupervisionStrategy].decider

def withSupervision[T](f: () => T): Option[T] =
try {
Some(f())
} catch {
case NonFatal(ex) =>
decider(ex) match {
case Supervision.Stop => onStop(ex)
case Supervision.Resume => onResume(ex)
case Supervision.Restart => onRestart(ex)
}
None
}

def onResume(t: Throwable): Unit

def onStop(t: Throwable): Unit = failStage(t)

def onRestart(t: Throwable): Unit = onResume(t)
}

private[stream] object Collect {
// Cached function that can be used with PartialFunction.applyOrElse to ensure that A) the guard is only applied once,
// and the caller can check the returned value with Collect.notApplied to query whether the PF was applied or not.
Expand Down

0 comments on commit dac6c73

Please sign in to comment.