Merge pull request #28360 from WadeWaldron/stash-docs

Adding a clarification to the Akka Classic stash documentation about what happens when an actor is restarted.
This commit is contained in:
Patrik Nordwall 2019-12-12 11:59:10 +01:00 committed by GitHub
commit d115b61821
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1154,9 +1154,16 @@ callback. This means it's not possible to write
Note that the stash is part of the ephemeral actor state, unlike the
mailbox. Therefore, it should be managed like other parts of the
actor's state which have the same property. The @scala[`Stash` traits] @java[`AbstractActorWithStash`]
implementation of `preRestart` will call `unstashAll()`, which is
usually the desired behavior.
actor's state which have the same property.
However, the @scala[`Stash` traits] @java[`AbstractActorWithStash`]
implementation of `preRestart` will call `unstashAll()`. This means
that prior to the actor restarting, it will transfer all stashed
messages back to the actor's mailbox.
The result of this is that when an actor is restarted, any stashed
messages will be delivered to the new incarnation of the actor.
This is usually the desired behavior.
@@@ note