Adding a clarification to the Akka Classic stash documentation about what happens when an actor is restarted.

This commit is contained in:
wadewaldron 2019-12-11 15:42:30 -06:00
parent ac408bba8f
commit 325209b65f

View file

@ -1283,9 +1283,16 @@ callback. This means it's not possible to write
Note that the stash is part of the ephemeral actor state, unlike the Note that the stash is part of the ephemeral actor state, unlike the
mailbox. Therefore, it should be managed like other parts of 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`] actor's state which have the same property.
implementation of `preRestart` will call `unstashAll()`, which is
usually the desired behavior. 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 @@@ note