From 8bb6e22853317403f0d09d02f0335bb67353b652 Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Sun, 22 Dec 2024 21:15:45 +0800 Subject: [PATCH] chore: Remove SupervisedGraphStageLogic (#1619) --- ...ource-flow-with-context.backwards.excludes | 17 +++++++++++ ...ource-flow-with-context.backwards.excludes | 21 ++++++++++++-- ...vised-group-stage-logic.backwards.excludes | 19 ++++++++++++ .../apache/pekko/stream/impl/fusing/Ops.scala | 29 +------------------ 4 files changed, 56 insertions(+), 30 deletions(-) create mode 100644 stream/src/main/mima-filters/1.0.x.backwards.excludes/pr-1619-remove-supervised-group-stage-logic.backwards.excludes diff --git a/stream/src/main/mima-filters/1.0.x.backwards.excludes/pr-1443-also-alsoTo-source-flow-with-context.backwards.excludes b/stream/src/main/mima-filters/1.0.x.backwards.excludes/pr-1443-also-alsoTo-source-flow-with-context.backwards.excludes index 4006d402a19..e1fcc898fa0 100644 --- a/stream/src/main/mima-filters/1.0.x.backwards.excludes/pr-1443-also-alsoTo-source-flow-with-context.backwards.excludes +++ b/stream/src/main/mima-filters/1.0.x.backwards.excludes/pr-1443-also-alsoTo-source-flow-with-context.backwards.excludes @@ -1,2 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + ProblemFilters.exclude[ReversedMissingMethodProblem]("org.apache.pekko.stream.scaladsl.FlowWithContextOps.alsoTo") ProblemFilters.exclude[ReversedMissingMethodProblem]("org.apache.pekko.stream.scaladsl.FlowWithContextOps.alsoToContext") diff --git a/stream/src/main/mima-filters/1.0.x.backwards.excludes/pr-1446-wireTap-wireTapContext-source-flow-with-context.backwards.excludes b/stream/src/main/mima-filters/1.0.x.backwards.excludes/pr-1446-wireTap-wireTapContext-source-flow-with-context.backwards.excludes index 0eb85a68d49..a29d3010e0c 100644 --- a/stream/src/main/mima-filters/1.0.x.backwards.excludes/pr-1446-wireTap-wireTapContext-source-flow-with-context.backwards.excludes +++ b/stream/src/main/mima-filters/1.0.x.backwards.excludes/pr-1446-wireTap-wireTapContext-source-flow-with-context.backwards.excludes @@ -1,2 +1,19 @@ - ProblemFilters.exclude[ReversedMissingMethodProblem]("org.apache.pekko.stream.scaladsl.FlowWithContextOps.wireTap") - ProblemFilters.exclude[ReversedMissingMethodProblem]("org.apache.pekko.stream.scaladsl.FlowWithContextOps.wireTapContext") +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +ProblemFilters.exclude[ReversedMissingMethodProblem]("org.apache.pekko.stream.scaladsl.FlowWithContextOps.wireTap") +ProblemFilters.exclude[ReversedMissingMethodProblem]("org.apache.pekko.stream.scaladsl.FlowWithContextOps.wireTapContext") diff --git a/stream/src/main/mima-filters/1.0.x.backwards.excludes/pr-1619-remove-supervised-group-stage-logic.backwards.excludes b/stream/src/main/mima-filters/1.0.x.backwards.excludes/pr-1619-remove-supervised-group-stage-logic.backwards.excludes new file mode 100644 index 00000000000..7043eaf6a99 --- /dev/null +++ b/stream/src/main/mima-filters/1.0.x.backwards.excludes/pr-1619-remove-supervised-group-stage-logic.backwards.excludes @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Remove SupervisedGraphStageLogic +ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.stream.impl.fusing.SupervisedGraphStageLogic") diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala index d892a049526..1b23fc96c98 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala @@ -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, _ } @@ -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.