Skip to content

Conversation

@Roiocam
Copy link
Contributor

@Roiocam Roiocam commented Jul 5, 2024

References #31350

@Roiocam Roiocam marked this pull request as draft July 9, 2024 09:57
@Roiocam Roiocam force-pushed the flatten-supervising branch from 7654d09 to dfaccbc Compare August 24, 2024 04:48
Copy link
Contributor

@patriknw patriknw left a comment

Choose a reason for hiding this comment

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

great that you picked up this

@leviramsey
Copy link
Contributor

Retriggering CI after #32489

@Roiocam Roiocam force-pushed the flatten-supervising branch from 1597d12 to 92021e9 Compare August 29, 2024 13:43
@Roiocam Roiocam marked this pull request as ready for review August 30, 2024 01:31
Behaviors
.supervise(behavior)
.whenFailure[IllegalStateException](SupervisorStrategy.restart)
.whenFailure[IllegalArgumentException](SupervisorStrategy.stop)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should show this as the main way now that we have it, not sure we need to show the other one at all

whenFailure(strategy)(ClassTag(clazz))

private[akka] def unwrap: Behavior[T] = wrapped
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunate that the entire class needs to be public, but maybe separating in public trait and impl would be tricky. Make it final and replace "not for user extension" with "Not for user instantiation.

@InternalApi would mean the entire type is internal but we return it so drop that but put it on the unwrap method which becomes public from Java.

*/
def onFailure[Thr <: Throwable](clazz: Class[Thr], strategy: SupervisorStrategy): Behavior[T] =
Supervisor(Behavior.validateAsInitial(wrapped), strategy)(ClassTag(clazz))
new SuperviseBehavior[T](wrapped).whenFailure(clazz, strategy).unwrap
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it not be safe to change the return type here to a subtype of Behavior and not need the separate whenFailure name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants