Ticket 964: rename of reply?

This commit is contained in:
Peter Veentjer 2011-07-17 09:02:36 +03:00
parent e7b33d46c2
commit 7983a66f68
14 changed files with 44 additions and 36 deletions

View file

@ -335,13 +335,13 @@ If you want to send a message back to the original sender of the message you jus
In this case the ``result`` will be send back to the Actor that sent the ``request``.
The ``reply`` method throws an ``IllegalStateException`` if unable to determine what to reply to, e.g. the sender is not an actor. You can also use the more forgiving ``reply_?`` method which returns ``true`` if reply was sent, and ``false`` if unable to determine what to reply to.
The ``reply`` method throws an ``IllegalStateException`` if unable to determine what to reply to, e.g. the sender is not an actor. You can also use the more forgiving ``tryReply`` method which returns ``true`` if reply was sent, and ``false`` if unable to determine what to reply to.
.. code-block:: scala
case request =>
val result = process(request)
if (self.reply_?(result)) ...// success
if (self.tryReply(result)) ...// success
else ... // handle failure
Summary of reply semantics and options

View file

@ -322,16 +322,16 @@ Supervised actors have the option to reply to the initial sender within preResta
}
override def preRestart(reason: scala.Throwable) {
self.reply_?(reason.getMessage)
self.tryReply(reason.getMessage)
}
override def postStop() {
self.reply_?("stopped by supervisor")
self.tryReply("stopped by supervisor")
}
}
- A reply within preRestart or postRestart must be a safe reply via `self.reply_?` because an unsafe self.reply will throw an exception when the actor is restarted without having failed. This can be the case in context of AllForOne restart strategies.
- A reply within postStop must be a safe reply via `self.reply_?` because an unsafe self.reply will throw an exception when the actor has been stopped by the application (and not by a supervisor) after successful execution of receive (or no execution at all).
- A reply within preRestart or postRestart must be a safe reply via `self.tryReply` because an unsafe self.reply will throw an exception when the actor is restarted without having failed. This can be the case in context of AllForOne restart strategies.
- A reply within postStop must be a safe reply via `self.tryReply` because an unsafe self.reply will throw an exception when the actor has been stopped by the application (and not by a supervisor) after successful execution of receive (or no execution at all).
Handling too many actor restarts within a specific time limit
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^