monifu.concurrent

Scheduler

trait Scheduler extends ExecutionContext with UncaughtExceptionReporter

A Scheduler is an scala.concurrent.ExecutionContext that additionally can schedule the execution of units of work to run with a delay or periodically.

Annotations
@implicitNotFound( ... )
Linear Supertypes
UncaughtExceptionReporter, ExecutionContext, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Scheduler
  2. UncaughtExceptionReporter
  3. ExecutionContext
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def execute(runnable: Runnable): Unit

    Runs a block of code in this ExecutionContext.

    Runs a block of code in this ExecutionContext.

    Definition Classes
    Scheduler → ExecutionContext
  2. abstract def reportFailure(t: Throwable): Unit

    Reports that an asynchronous computation failed.

    Reports that an asynchronous computation failed.

    Definition Classes
    SchedulerUncaughtExceptionReporter → ExecutionContext
  3. abstract def scheduleOnce(initialDelay: FiniteDuration, action: ⇒ Unit): Cancelable

    Schedules a task to run in the future, after initialDelay.

    Schedules a task to run in the future, after initialDelay.

    For example the following schedules a message to be printed to standard output after 5 minutes:

    val task = scheduler.scheduleOnce(5.minutes, {
      println("Hello, world!")
    })
    
    // later if you change your mind ...
    task.cancel()
    initialDelay

    is the time to wait until the execution happens

    action

    is the callback to be executed

    returns

    a Cancelable that can be used to cancel the created task before execution.

Concrete Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  15. final def notify(): Unit

    Definition Classes
    AnyRef
  16. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  17. def prepare(): ExecutionContext

    Definition Classes
    ExecutionContext
  18. def scheduleOnce(action: ⇒ Unit): Cancelable

    Schedules the given action for immediate execution.

    Schedules the given action for immediate execution.

    returns

    a Cancelable that can be used to cancel the task in case it hasn't been executed yet.

  19. def scheduleRecursive(initialDelay: FiniteDuration, delay: FiniteDuration, action: (() ⇒ Unit) ⇒ Unit): Cancelable

    Schedules a task for periodic execution.

    Schedules a task for periodic execution. The callback scheduled for execution receives a function as parameter, a function that can be used to reschedule the execution or consequently to stop it.

    This variant of scheduleRepeated is useful if at some point you want to stop the execution from within the callback.

    The following increments a number every 5 seconds until the number reaches 20, then prints a message and stops:

    var counter = 0
    
    scheduler.schedule(5.seconds, 5.seconds, { reschedule =>
      count += 1
      if (counter < 20)
        reschedule()
      else
        println("Done!")
    })
    initialDelay

    is the time to wait until the first execution happens

    delay

    is the time to wait between 2 subsequent executions of the task

    action

    is the callback to be executed

    returns

    a cancelable that can be used to cancel the task at any time.

  20. def scheduleRepeated(initialDelay: FiniteDuration, delay: FiniteDuration, action: ⇒ Unit): Cancelable

    Schedules a task for execution repeated with the given delay between executions.

    Schedules a task for execution repeated with the given delay between executions. The first execution happens after initialDelay.

    For example the following schedules a message to be printed to standard output every 10 seconds with an initial delay of 5 seconds:

    val task = scheduler.scheduleRepeated(5.seconds, 10.seconds , {
      println("Hello, world!")
    })
    
    // later if you change your mind ...
    task.cancel()
    initialDelay

    is the time to wait until the first execution happens

    delay

    is the time to wait between 2 subsequent executions of the task

    action

    is the callback to be executed

    returns

    a cancelable that can be used to cancel the execution of this repeated task at any time.

  21. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  22. def toString(): String

    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from UncaughtExceptionReporter

Inherited from ExecutionContext

Inherited from AnyRef

Inherited from Any

Ungrouped