Changes according to review. #2513
This commit is contained in:
parent
99ad1e0eeb
commit
c63234ca4c
5 changed files with 50 additions and 50 deletions
|
|
@ -15,10 +15,10 @@ import docs.pattern.SchedulerPatternSpec.ScheduleInConstructor
|
|||
object SchedulerPatternSpec {
|
||||
//#schedule-constructor
|
||||
class ScheduleInConstructor extends Actor {
|
||||
import context._
|
||||
|
||||
val tick = system.scheduler.schedule(500 millis, 1000 millis, self, "tick")
|
||||
val tick =
|
||||
context.system.scheduler.schedule(500 millis, 1000 millis, self, "tick")
|
||||
//#schedule-constructor
|
||||
// this var and constructor is declared here to not show up in the docs
|
||||
var target: ActorRef = null
|
||||
def this(target: ActorRef) = { this(); this.target = target }
|
||||
//#schedule-constructor
|
||||
|
|
@ -41,6 +41,7 @@ object SchedulerPatternSpec {
|
|||
class ScheduleInReceive extends Actor {
|
||||
import context._
|
||||
//#schedule-receive
|
||||
// this var and constructor is declared here to not show up in the docs
|
||||
var target: ActorRef = null
|
||||
def this(target: ActorRef) = { this(); this.target = target }
|
||||
//#schedule-receive
|
||||
|
|
|
|||
|
|
@ -123,7 +123,10 @@ message sends to the same actor.
|
|||
|
||||
.. note::
|
||||
|
||||
With this approach the scheduler will be restarted with the actor on restarts.
|
||||
With this approach the scheduled periodic message send will be restarted with the actor on restarts.
|
||||
This also means that the time period that elapses between two tick messages during a restart may drift
|
||||
off based on when you restart the scheduled message sends relative to the time that the last message was
|
||||
sent, and how long the initial delay is. Worst case scenario is ``interval`` plus ``initialDelay``.
|
||||
|
||||
.. includecode:: code/docs/pattern/SchedulerPatternSpec.scala#schedule-constructor
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue