trait Timer extends AnyRef
Timers are used to schedule tasks in the future. They support both one-shot and recurring tasks.
Timers propagate Local state, including the Monitor, from when the task is scheduled to when it is run.
- Note
Scheduling tasks with Timers should rarely be done directly; for example, when programming with Futures, prefer using Future.sleep.
- See also
MockTimer for use in tests that require determinism.
- Alphabetic
- By Inheritance
- Timer
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def scheduleOnce(when: Time)(f: => Unit): TimerTask
- Attributes
- protected
- abstract def schedulePeriodically(when: Time, period: Duration)(f: => Unit): TimerTask
- Attributes
- protected
- abstract def stop(): Unit
Stop the timer.
Stop the timer. Pending tasks are cancelled. The timer is unusable after being stopped.
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def doAt[A](time: Time)(f: => A): Future[A]
Performs an operation at the specified time.
- def doLater[A](delay: Duration)(f: => A): Future[A]
Performs an operation after the specified delay.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def schedule(period: Duration)(f: => Unit): TimerTask
Run
fevery elapsedperiod, startingperiodfrom now. - final def schedule(when: Time, period: Duration)(f: => Unit): TimerTask
Run
fat timewhen; subsequently runfat every elapsedperiod.Run
fat timewhen; subsequently runfat every elapsedperiod.- Note
If
,periodis negative or undefined, the timer task will be rescheduled immediately (i.e.,periodwill be treated as Duration.Zero).If
whenis negative or undefined, it will be treated as Time.epoch.
- final def schedule(when: Time)(f: => Unit): TimerTask
Run
fat timewhen.Run
fat timewhen.- Note
If
whenis negative or undefined, it will be treated as Time.epoch.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()