implicit final class Extensions extends AnyVal with ExecuteExtensions
- Alphabetic
- By Inheritance
- Extensions
- ExecuteExtensions
- AnyVal
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
executeAsync(cb: Runnable): Unit
Schedules the given callback for asynchronous execution in the thread-pool.
Schedules the given callback for asynchronous execution in the thread-pool.
On Scala < 2.12 it is described as a macro, so it has zero overhead, being perfectly equivalent with
execute(new Runnable { ... })
.On Scala 2.12 because of the Java 8 SAM types integration, this extension macro is replaced with a method that takes a plain
Runnable
as parameter.- cb
the callback to execute asynchronously
- Definition Classes
- ExecuteExtensions
-
def
executeAsyncBatch(cb: TrampolinedRunnable): Unit
Schedules the given callback for asynchronous execution in the thread-pool, but also indicates the start of a thread-local trampoline in case the scheduler is a BatchingScheduler.
Schedules the given callback for asynchronous execution in the thread-pool, but also indicates the start of a thread-local trampoline in case the scheduler is a BatchingScheduler.
This utility is provided as an optimization. If you don't understand what this does, then don't worry about it.
On Scala < 2.12 it is described as a macro, so it has zero overhead. On Scala 2.12 because of the Java 8 SAM types integration, this extension macro is replaced with a method that takes a plain
TrampolinedRunnable
as parameter.- cb
the callback to execute asynchronously
- Definition Classes
- ExecuteExtensions
-
def
executeTrampolined(cb: TrampolinedRunnable): Unit
Schedules the given callback for immediate execution as a TrampolinedRunnable.
Schedules the given callback for immediate execution as a TrampolinedRunnable. Depending on the execution context, it might get executed on the current thread by using an internal trampoline, so it is still safe from stack-overflow exceptions.
On Scala < 2.12 it is described as a macro, so it has zero overhead, being perfectly equivalent with
execute(new TrampolinedRunnable { ... })
.On Scala 2.12 because of the Java 8 SAM types integration, this extension macro is replaced with a method that takes a plain
TrampolinedRunnable
as parameter.- cb
the callback to execute asynchronously
- Definition Classes
- ExecuteExtensions
-
def
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
scheduleAtFixedRate(initialDelay: FiniteDuration, period: FiniteDuration)(action: ⇒ Unit): Cancelable
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
theninitialDelay + period
, theninitialDelay + 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) { print("Repeated message") } // 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.
-
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) { print("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.
-
def
scheduleWithFixedDelay(initialDelay: FiniteDuration, delay: FiniteDuration)(action: ⇒ Unit): Cancelable
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) { print("Repeated message") } // 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.
-
val
source: Scheduler
- Definition Classes
- Extensions → ExecuteExtensions
-
def
toString(): String
- Definition Classes
- Any
Deprecated Value Members
-
def
executeLocal(cb: ⇒ Unit): Unit
Deprecated.
Deprecated. Use executeTrampolined instead.
- Definition Classes
- ExecuteExtensions
- Annotations
- @deprecated
- Deprecated
(Since version 2.1.0) Renamed to
executeTrampolined
This is the API documentation for the Monix library.
Package Overview
monix.execution exposes lower level primitives for dealing with asynchronous execution:
Atomic
types, as alternative tojava.util.concurrent.atomic
monix.eval is for dealing with evaluation of results, thus exposing Task and Coeval.
monix.reactive exposes the
Observable
pattern:Observable
implementationsmonix.types implements type-class shims, to be translated to type-classes provided by libraries such as Cats or Scalaz.
monix.cats is the optional integration with the Cats library, providing translations for the types described in
monix.types
.monix.scalaz is the optional integration with the Scalaz library, providing translations for the types described in
monix.types
.