Moving all message typed besides Transition into FSM object
This commit is contained in:
parent
3494a2ae87
commit
bc24bc40a0
3 changed files with 13 additions and 8 deletions
|
|
@ -7,8 +7,19 @@ package akka.actor
|
|||
import scala.collection.mutable
|
||||
import java.util.concurrent.{ScheduledFuture, TimeUnit}
|
||||
|
||||
object FSM {
|
||||
sealed trait Reason
|
||||
case object Normal extends Reason
|
||||
case object Shutdown extends Reason
|
||||
case class Failure(cause: Any) extends Reason
|
||||
|
||||
case object StateTimeout
|
||||
case class TimeoutMarker(generation: Long)
|
||||
}
|
||||
|
||||
trait FSM[S, D] {
|
||||
this: Actor =>
|
||||
import FSM._
|
||||
|
||||
type StateFunction = scala.PartialFunction[Event, State]
|
||||
|
||||
|
|
@ -157,13 +168,5 @@ trait FSM[S, D] {
|
|||
}
|
||||
}
|
||||
|
||||
sealed trait Reason
|
||||
case object Normal extends Reason
|
||||
case object Shutdown extends Reason
|
||||
case class Failure(cause: Any) extends Reason
|
||||
|
||||
case object StateTimeout
|
||||
case class TimeoutMarker(generation: Long)
|
||||
|
||||
case class Transition(from: S, to: S)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import org.multiverse.api.latches.StandardLatch
|
|||
import java.util.concurrent.TimeUnit
|
||||
|
||||
object FSMActorSpec {
|
||||
import FSM._
|
||||
|
||||
val unlockedLatch = new StandardLatch
|
||||
val lockedLatch = new StandardLatch
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package sample.fsm.dining.fsm
|
||||
|
||||
import akka.actor.{ActorRef, Actor, FSM}
|
||||
import akka.actor.FSM._
|
||||
import Actor._
|
||||
import java.util.concurrent.TimeUnit
|
||||
import TimeUnit._
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue