Class/Object

monifu.concurrent.schedulers

AsyncScheduler

Related Docs: object AsyncScheduler | package schedulers

Permalink

final class AsyncScheduler extends ReferenceScheduler

An AsyncScheduler schedules tasks to happen in the future with the given ScheduledExecutorService and the tasks themselves are executed on the given ExecutionContext. It's a convenient way to piggyback on an existing execution context.

Source
AsyncScheduler.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AsyncScheduler
  2. ReferenceScheduler
  3. Scheduler
  4. UncaughtExceptionReporter
  5. ExecutionContext
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def currentTimeMillis(): Long

    Permalink

    Returns the current time in milliseconds.

    Returns the current time in milliseconds. Note that while the unit of time of the return value is a millisecond, the granularity of the value depends on the underlying operating system and may be larger. For example, many operating systems measure time in units of tens of milliseconds.

    It's the equivalent of System.currentTimeMillis(). When wanting to measure time, do not use System.currentTimeMillis() directly, prefer this method instead, because then it can be mocked for testing purposes (see for example TestScheduler)

    Definition Classes
    ReferenceSchedulerScheduler
  7. val env: Environment

    Permalink

    Information about the environment on top of which our scheduler runs on.

    Information about the environment on top of which our scheduler runs on.

    Definition Classes
    AsyncSchedulerScheduler
  8. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  10. def execute(runnable: Runnable): Unit

    Permalink

    Runs a block of code in this ExecutionContext.

    Runs a block of code in this ExecutionContext.

    Definition Classes
    AsyncSchedulerReferenceSchedulerScheduler → ExecutionContext
  11. def execute(action: ⇒ Unit): Unit

    Permalink

    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.

    Definition Classes
    ReferenceSchedulerScheduler
  12. def finalize(): Unit

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. def prepare(): ExecutionContext

    Permalink
    Definition Classes
    ExecutionContext
  20. def reportFailure(t: Throwable): Unit

    Permalink

    Reports that an asynchronous computation failed.

    Reports that an asynchronous computation failed.

    Definition Classes
    AsyncSchedulerReferenceSchedulerSchedulerUncaughtExceptionReporter → ExecutionContext
  21. def scheduleAtFixedRate(initialDelay: Long, period: Long, unit: TimeUnit, r: Runnable): Cancelable

    Permalink

    Schedules a periodic task that becomes enabled first after the given initial delay, and subsequently with the given period.

    Schedules a periodic task that becomes enabled first after the given initial delay, and subsequently with the given period. Executions will commence after initialDelay then initialDelay + period, then initialDelay + 2 * period and so on.

    If any execution of the task encounters an exception, subsequent executions are suppressed. Otherwise, the task will only terminate via cancellation or termination of the scheduler. If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.

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

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

    is the time to wait until the first execution happens

    period

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

    unit

    is the time unit used for the initialDelay and the period parameters

    r

    is the callback to be executed

    returns

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

    Definition Classes
    AsyncSchedulerReferenceSchedulerScheduler
  22. def scheduleAtFixedRate(initialDelay: FiniteDuration, period: FiniteDuration, r: Runnable): Cancelable

    Permalink

    Schedules a periodic task that becomes enabled first after the given initial delay, and subsequently with the given period.

    Schedules a periodic task that becomes enabled first after the given initial delay, and subsequently with the given period. Executions will commence after initialDelay then initialDelay + period, then initialDelay + 2 * period and so on.

    If any execution of the task encounters an exception, subsequent executions are suppressed. Otherwise, the task will only terminate via cancellation or termination of the scheduler. If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.

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

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

    is the time to wait until the first execution happens

    period

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

    r

    is the callback to be executed

    returns

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

    Definition Classes
    AsyncSchedulerReferenceSchedulerScheduler
  23. def scheduleAtFixedRate(initialDelay: Long, period: Long, unit: TimeUnit)(action: ⇒ Unit): Cancelable

    Permalink

    Schedules a periodic task that becomes enabled first after the given initial delay, and subsequently with the given period.

    Schedules a periodic task that becomes enabled first after the given initial delay, and subsequently with the given period. Executions will commence after initialDelay then initialDelay + period, then initialDelay + 2 * period and so on.

    If any execution of the task encounters an exception, subsequent executions are suppressed. Otherwise, the task will only terminate via cancellation or termination of the scheduler. If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.

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

    val task = scheduler.scheduleAtFixedRate(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

    period

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

    unit

    is the time unit used for the initialDelay and the period parameters

    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.

    Definition Classes
    ReferenceSchedulerScheduler
  24. def scheduleAtFixedRate(initialDelay: FiniteDuration, period: FiniteDuration)(action: ⇒ Unit): Cancelable

    Permalink

    Schedules a periodic task that becomes enabled first after the given initial delay, and subsequently with the given period.

    Schedules a periodic task that becomes enabled first after the given initial delay, and subsequently with the given period. Executions will commence after initialDelay then initialDelay + period, then initialDelay + 2 * period and so on.

    If any execution of the task encounters an exception, subsequent executions are suppressed. Otherwise, the task will only terminate via cancellation or termination of the scheduler. If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.

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

    val task = scheduler.scheduleAtFixedRate(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

    period

    is the time to wait between 2 successive 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.

    Definition Classes
    ReferenceSchedulerScheduler
  25. def scheduleOnce(initialDelay: Long, unit: TimeUnit, r: Runnable): Cancelable

    Permalink

    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, new Runnable {
      def run() = println("Hello, world!")
    })
    
    // later if you change your mind ...
    task.cancel()
    initialDelay

    is the time to wait until the execution happens

    unit

    is the time unit used for initialDelay

    r

    is the callback to be executed

    returns

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

    Definition Classes
    AsyncSchedulerScheduler
  26. def scheduleOnce(initialDelay: FiniteDuration, r: Runnable): Cancelable

    Permalink

    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, new Runnable {
      def run() = println("Hello, world!")
    })
    
    // later if you change your mind ...
    task.cancel()
    initialDelay

    is the time to wait until the execution happens

    r

    is the callback to be executed

    returns

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

    Definition Classes
    AsyncSchedulerScheduler
  27. def scheduleOnce(initialDelay: Long, unit: TimeUnit)(action: ⇒ Unit): Cancelable

    Permalink

    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

    unit

    is the time unit used for initialDelay

    action

    is the callback to be executed

    returns

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

    Definition Classes
    ReferenceSchedulerScheduler
  28. def scheduleOnce(initialDelay: FiniteDuration)(action: ⇒ Unit): Cancelable

    Permalink

    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.

    Definition Classes
    ReferenceSchedulerScheduler
  29. def scheduleWithFixedDelay(initialDelay: Long, delay: Long, unit: TimeUnit, r: Runnable): Cancelable

    Permalink

    Schedules for execution a periodic task that is first executed after the given initial delay and subsequently with the given delay between the termination of one execution and the commencement of the next.

    Schedules for execution a periodic task that is first executed after the given initial delay and subsequently with the given delay between the termination of one execution and the commencement of the next.

    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 = s.scheduleWithFixedDelay(5.seconds, 10.seconds, new Runnable {
      def run() = 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 successive executions of the task

    unit

    is the time unit used for the initialDelay and the delay parameters

    r

    is the callback to be executed

    returns

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

    Definition Classes
    AsyncSchedulerReferenceSchedulerScheduler
  30. def scheduleWithFixedDelay(initialDelay: FiniteDuration, delay: FiniteDuration, r: Runnable): Cancelable

    Permalink

    Schedules for execution a periodic task that is first executed after the given initial delay and subsequently with the given delay between the termination of one execution and the commencement of the next.

    Schedules for execution a periodic task that is first executed after the given initial delay and subsequently with the given delay between the termination of one execution and the commencement of the next.

    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 = s.scheduleWithFixedDelay(5.seconds, 10.seconds, new Runnable {
      def run() = 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 successive executions of the task

    r

    is the callback to be executed

    returns

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

    Definition Classes
    AsyncSchedulerReferenceSchedulerScheduler
  31. def scheduleWithFixedDelay(initialDelay: Long, delay: Long, unit: TimeUnit)(action: ⇒ Unit): Cancelable

    Permalink

    Schedules for execution a periodic task that is first executed after the given initial delay and subsequently with the given delay between the termination of one execution and the commencement of the next.

    Schedules for execution a periodic task that is first executed after the given initial delay and subsequently with the given delay between the termination of one execution and the commencement of the next.

    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 = s.scheduleWithFixedDelay(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 successive executions of the task

    unit

    is the time unit used for the initialDelay and the delay parameters

    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.

    Definition Classes
    ReferenceSchedulerScheduler
  32. def scheduleWithFixedDelay(initialDelay: FiniteDuration, delay: FiniteDuration)(action: ⇒ Unit): Cancelable

    Permalink

    Schedules for execution a periodic task that is first executed after the given initial delay and subsequently with the given delay between the termination of one execution and the commencement of the next.

    Schedules for execution a periodic task that is first executed after the given initial delay and subsequently with the given delay between the termination of one execution and the commencement of the next.

    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 = s.scheduleWithFixedDelay(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 successive 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.

    Definition Classes
    ReferenceSchedulerScheduler
  33. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  34. def toString(): String

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from ReferenceScheduler

Inherited from Scheduler

Inherited from UncaughtExceptionReporter

Inherited from ExecutionContext

Inherited from AnyRef

Inherited from Any

Ungrouped