From 480f5d5683569d324dad7cf0f883c47fcad86320 Mon Sep 17 00:00:00 2001 From: Roland Date: Mon, 5 Nov 2012 22:11:57 +0100 Subject: [PATCH] make FSM.receive overridable, see #2680 --- akka-actor/src/main/scala/akka/actor/FSM.scala | 2 +- akka-docs/rst/scala/fsm.rst | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/akka-actor/src/main/scala/akka/actor/FSM.scala b/akka-actor/src/main/scala/akka/actor/FSM.scala index 273ab765c3..069691ce67 100644 --- a/akka-actor/src/main/scala/akka/actor/FSM.scala +++ b/akka-actor/src/main/scala/akka/actor/FSM.scala @@ -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") diff --git a/akka-docs/rst/scala/fsm.rst b/akka-docs/rst/scala/fsm.rst index bcccce0197..4ace396a14 100644 --- a/akka-docs/rst/scala/fsm.rst +++ b/akka-docs/rst/scala/fsm.rst @@ -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