Merge pull request #845 from akka/wip-2680-FSM-receive-∂π

make FSM.receive overridable, see #2680
This commit is contained in:
Roland Kuhn 2012-11-06 03:03:49 -08:00
commit 4c4472f01b
2 changed files with 9 additions and 1 deletions

View file

@ -521,7 +521,7 @@ trait FSM[S, D] extends Listeners with ActorLogging {
* Main actor receive() method
* *******************************************
*/
override final def receive: Receive = {
override def receive: Receive = {
case TimeoutMarker(gen)
if (generation == gen) {
processMsg(StateTimeout, "state timeout")

View file

@ -124,6 +124,14 @@ obvious that an actor is actually created:
:include: simple-fsm
:exclude: fsm-body
.. note::
The FSM trait defines a ``receive`` method which handles internal messages
and passes everything else through to the FSM logic (according to the
current state). When overriding the ``receive`` method, keep in mind that
e.g. state timeout handling depends on actually passing the messages through
the FSM logic.
The :class:`FSM` trait takes two type parameters:
#. the supertype of all state names, usually a sealed trait with case objects