Add PreRestart to typed docs #26899

This commit is contained in:
Johan Andrén 2019-09-19 16:23:32 +02:00 committed by GitHub
parent 111ca90b2b
commit 3b3ce85b22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 98 additions and 7 deletions

View file

@ -122,6 +122,18 @@ Java
That means that the `setup` block will only be run when the parent actor is first started, and not when it is
restarted.
## The PreRestart signal
Before a supervised actor is restarted it is sent the @apidoc[akka.actor.typed.PreRestart] signal giving it a chance to clean up resources
it has created, much like the @apidoc[akka.actor.typed.PostStop] signal when the actor stops.
The returned behavior from the `PreRestart` signal is ignored.
Scala
: @@snip [SupervisionCompileOnly.scala](/akka-actor-typed-tests/src/test/scala/docs/akka/typed/supervision/SupervisionCompileOnly.scala) { #restart-PreRestart-signal }
Java
: @@snip [SupervisionCompileOnlyTest.java](/akka-actor-typed-tests/src/test/java/jdocs/akka/typed/supervision/SupervisionCompileOnlyTest.java) { #restart-PreRestart-signal }
## Bubble failures up through the hierarchy
In some scenarios it may be useful to push the decision about what to do on a failure upwards in the Actor hierarchy