-
Couldn't load subscription status.
- Fork 3.6k
feat: support the flattening syntax for supervising #32465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
7654d09 to
dfaccbc
Compare
There was a problem hiding this 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
akka-actor-typed/src/main/scala/akka/actor/typed/javadsl/Behaviors.scala
Outdated
Show resolved
Hide resolved
|
Retriggering CI after #32489 |
1597d12 to
92021e9
Compare
| Behaviors | ||
| .supervise(behavior) | ||
| .whenFailure[IllegalStateException](SupervisorStrategy.restart) | ||
| .whenFailure[IllegalArgumentException](SupervisorStrategy.stop) |
There was a problem hiding this comment.
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 | ||
| } |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
References #31350