+act #3648 Add default repeat=false in FSM.setTimer

This commit is contained in:
Patrik Nordwall 2014-01-13 07:50:27 +01:00
parent e25455e935
commit ea44306133
3 changed files with 7 additions and 7 deletions

View file

@ -200,12 +200,12 @@ object FSMTimingSpec {
goto(Initial)
}
onTransition {
case Initial -> TestSingleTimerResubmit setTimer("blah", Tick, 500.millis.dilated, false)
case Initial -> TestSingleTimerResubmit setTimer("blah", Tick, 500.millis.dilated)
}
when(TestSingleTimerResubmit) {
case Event(Tick, _)
tester ! Tick
setTimer("blah", Tock, 500.millis.dilated, false)
setTimer("blah", Tock, 500.millis.dilated)
stay()
case Event(Tock, _)
tester ! Tock
@ -213,11 +213,11 @@ object FSMTimingSpec {
}
when(TestCancelTimer) {
case Event(Tick, _)
setTimer("hallo", Tock, 1.milli.dilated, false)
setTimer("hallo", Tock, 1.milli.dilated)
TestKit.awaitCond(context.asInstanceOf[ActorCell].mailbox.hasMessages, 1.second.dilated)
cancelTimer("hallo")
sender ! Tick
setTimer("hallo", Tock, 500.millis.dilated, false)
setTimer("hallo", Tock, 500.millis.dilated)
stay
case Event(Tock, _)
tester ! Tock
@ -240,7 +240,7 @@ object FSMTimingSpec {
// FSM is suspended after processing this message and resumed 500ms later
case Event(Tick, _)
suspend(self)
setTimer("named", Tock, 1.millis.dilated, false)
setTimer("named", Tock, 1.millis.dilated)
TestKit.awaitCond(context.asInstanceOf[ActorCell].mailbox.hasMessages, 1.second.dilated)
stay forMax (1.millis.dilated) replying Tick
case Event(Tock, _)

View file

@ -346,7 +346,7 @@ trait FSM[S, D] extends Actor with Listeners with ActorLogging {
* @param repeat send once if false, scheduleAtFixedRate if true
* @return current state descriptor
*/
final def setTimer(name: String, msg: Any, timeout: FiniteDuration, repeat: Boolean): Unit = {
final def setTimer(name: String, msg: Any, timeout: FiniteDuration, repeat: Boolean = false): Unit = {
if (debugEvent)
log.debug("setting " + (if (repeat) "repeating " else "") + "timer '" + name + "'/" + timeout + ": " + msg)
if (timers contains name) {

View file

@ -67,7 +67,7 @@ class TestFSMRef[S, D, T <: Actor](
/**
* Proxy for [[FSM#setTimer]].
*/
def setTimer(name: String, msg: Any, timeout: FiniteDuration, repeat: Boolean) {
def setTimer(name: String, msg: Any, timeout: FiniteDuration, repeat: Boolean = false) {
fsm.setTimer(name, msg, timeout, repeat)
}