Packages

  • package root

    This is the API documentation for the Monix library.

    Package Overview

    monix.execution exposes lower level primitives for dealing with asynchronous execution:

    monix.eval is for dealing with evaluation of results, thus exposing Task and Coeval.

    monix.reactive exposes the Observable pattern:

    monix.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.

    Definition Classes
    root
  • package monix
    Definition Classes
    root
  • package execution
    Definition Classes
    monix
  • package atomic

    A small toolkit of classes that support compare-and-swap semantics for safe mutation of variables.

    A small toolkit of classes that support compare-and-swap semantics for safe mutation of variables.

    On top of the JVM, this means dealing with lock-free thread-safe programming. Also works on top of Javascript, with Scala.js, for API compatibility purposes and because it's a useful way to box a value.

    The backbone of Atomic references is this method:

    def compareAndSet(expect: T, update: T): Boolean

    This method atomically sets a variable to the update value if it currently holds the expect value, reporting true on success or false on failure. The classes in this package also contain methods to get and unconditionally set values.

    Building a reference is easy with the provided constructor, which will automatically return the most specific type needed (in the following sample, that's an AtomicDouble, inheriting from AtomicNumber[T]):

    val atomicNumber = Atomic(12.2)
    
    atomicNumber.incrementAndGet()
    // => 13.2

    These also provide useful helpers for atomically mutating of values (i.e. transform, transformAndGet, getAndTransform, etc...) or of numbers of any kind (incrementAndGet, getAndAdd, etc...).

    Definition Classes
    execution
  • package cancelables

    Cancelables represent asynchronous units of work or other things scheduled for execution and whose execution can be canceled.

    Cancelables represent asynchronous units of work or other things scheduled for execution and whose execution can be canceled.

    One use-case is the scheduling done by monix.execution.Scheduler, in which the scheduling methods return a Cancelable, allowing the canceling of the scheduling.

    Example:

    val s = ConcurrentScheduler()
    val task = s.scheduleRepeated(10.seconds, 50.seconds, {
      doSomething()
    })
    
    // later, cancels the scheduling ...
    task.cancel()
    Definition Classes
    execution
  • package exceptions
    Definition Classes
    execution
  • package internal
    Definition Classes
    execution
  • package misc
    Definition Classes
    execution
  • package rstreams
    Definition Classes
    execution
  • package schedulers
    Definition Classes
    execution
  • Ack
  • Cancelable
  • CancelableFuture
  • ExecutionModel
  • FutureUtils
  • Listener
  • Macros
  • Scheduler
  • UncaughtExceptionReporter

object Scheduler extends SchedulerCompanionImpl with Serializable

Source
Scheduler.scala
Linear Supertypes
Serializable, Serializable, SchedulerCompanionImpl, SchedulerCompanion, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Scheduler
  2. Serializable
  3. Serializable
  4. SchedulerCompanionImpl
  5. SchedulerCompanion
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. implicit final class Extensions extends AnyVal with ExecuteExtensions

    Utilities complementing the Scheduler interface.

  2. trait ImplicitsLike extends AnyRef
    Definition Classes
    SchedulerCompanion

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. lazy val DefaultScheduledExecutor: ScheduledExecutorService

    The default ScheduledExecutor instance.

    The default ScheduledExecutor instance.

    Currently it's a single-threaded Java ScheduledExecutorService used for scheduling delayed tasks for execution. But the actual execution will not happen on this executor service. In general you can just reuse this one for all your scheduling needs.

    Definition Classes
    SchedulerCompanionImpl
  5. def apply(executionModel: ExecutionModel): Scheduler

    Scheduler builder - uses monix's default ScheduledExecutorService for handling the scheduling of tasks.

    Scheduler builder - uses monix's default ScheduledExecutorService for handling the scheduling of tasks. Uses Scala's s.c.ExecutionContext.global for actual execution.

    executionModel

    is the preferred ExecutionModel, a guideline for run-loops and producers of data. Use ExecutionModel.Default for the default.

    Definition Classes
    SchedulerCompanionImpl
  6. def apply(reporter: UncaughtExceptionReporter, executionModel: ExecutionModel): Scheduler

    Scheduler builder - uses monix's default ScheduledExecutorService for handling the scheduling of tasks.

    Scheduler builder - uses monix's default ScheduledExecutorService for handling the scheduling of tasks. Uses Scala's s.c.ExecutionContext.global for actual execution.

    reporter

    is the UncaughtExceptionReporter that logs uncaught exceptions. Wrap the given ExecutionContext.reportFailure or use UncaughtExceptionReporter.LogExceptionsToStandardErr for the default.

    executionModel

    is the preferred ExecutionModel, a guideline for run-loops and producers of data. Use ExecutionModel.Default for the default.

    Definition Classes
    SchedulerCompanionImpl
  7. def apply(ec: ExecutionContext, executionModel: ExecutionModel): Scheduler

    Scheduler builder - uses monix's default ScheduledExecutorService for handling the scheduling of tasks.

    Scheduler builder - uses monix's default ScheduledExecutorService for handling the scheduling of tasks.

    ec

    is the execution context in which all tasks will run.

    executionModel

    is the preferred ExecutionModel, a guideline for run-loops and producers of data. Use ExecutionModel.Default for the default.

    Definition Classes
    SchedulerCompanionImpl
  8. def apply(ec: ExecutionContext): Scheduler

    Scheduler builder - uses monix's default ScheduledExecutorService for handling the scheduling of tasks.

    Scheduler builder - uses monix's default ScheduledExecutorService for handling the scheduling of tasks.

    ec

    is the execution context in which all tasks will run.

    Definition Classes
    SchedulerCompanionImpl
  9. def apply(executor: ExecutorService, executionModel: ExecutionModel): SchedulerService

    Scheduler builder that converts a Java ExecutorService into a scheduler.

    Scheduler builder that converts a Java ExecutorService into a scheduler.

    executor

    is the ScheduledExecutorService that handles the scheduling of tasks into the future. If not provided, an internal default will be used. You can also create one with java.util.concurrent.Executors.

    executionModel

    is the preferred ExecutionModel, a guideline for run-loops and producers of data. Use ExecutionModel.Default for the default.

    Definition Classes
    SchedulerCompanionImpl
  10. def apply(executor: ExecutorService): SchedulerService

    Scheduler builder that converts a Java ExecutorService into a scheduler.

    Scheduler builder that converts a Java ExecutorService into a scheduler.

    executor

    is the ScheduledExecutorService that handles the scheduling of tasks into the future. If not provided, an internal default will be used. You can also create one with java.util.concurrent.Executors.

    Definition Classes
    SchedulerCompanionImpl
  11. def apply(executor: ExecutorService, reporter: UncaughtExceptionReporter, executionModel: ExecutionModel): SchedulerService

    Scheduler builder that converts a Java ExecutorService into a scheduler.

    Scheduler builder that converts a Java ExecutorService into a scheduler.

    executor

    is the ScheduledExecutorService that handles the scheduling of tasks into the future. If not provided, an internal default will be used. You can also create one with java.util.concurrent.Executors.

    reporter

    is the UncaughtExceptionReporter that logs uncaught exceptions. Wrap the given ExecutionContext.reportFailure or use UncaughtExceptionReporter.LogExceptionsToStandardErr for the default.

    executionModel

    is the preferred ExecutionModel, a guideline for run-loops and producers of data. Use ExecutionModel.Default for the default.

    Definition Classes
    SchedulerCompanionImpl
  12. def apply(executor: ExecutorService, reporter: UncaughtExceptionReporter): SchedulerService

    Scheduler builder that converts a Java ExecutorService into a scheduler.

    Scheduler builder that converts a Java ExecutorService into a scheduler.

    executor

    is the ScheduledExecutorService that handles the scheduling of tasks into the future. If not provided, an internal default will be used. You can also create one with java.util.concurrent.Executors.

    reporter

    is the UncaughtExceptionReporter that logs uncaught exceptions. Wrap the given ExecutionContext.reportFailure or use UncaughtExceptionReporter.LogExceptionsToStandardErr for the default.

    Definition Classes
    SchedulerCompanionImpl
  13. def apply(ec: ExecutionContext, reporter: UncaughtExceptionReporter, executionModel: ExecutionModel): Scheduler

    Scheduler builder .

    Scheduler builder .

    ec

    is the execution context in which all tasks will run. Use scala.concurrent.ExecutionContext.Implicits.global for the default.

    reporter

    is the UncaughtExceptionReporter that logs uncaught exceptions. Wrap the given ExecutionContext.reportFailure or use UncaughtExceptionReporter.LogExceptionsToStandardErr for the default.

    executionModel

    is the preferred ExecutionModel, a guideline for run-loops and producers of data. Use ExecutionModel.Default for the default.

    Definition Classes
    SchedulerCompanionImpl
  14. def apply(ec: ExecutionContext, reporter: UncaughtExceptionReporter): Scheduler

    Scheduler builder.

    Scheduler builder.

    ec

    is the execution context in which all tasks will run. Use scala.concurrent.ExecutionContext.Implicits.global for the default.

    reporter

    is the UncaughtExceptionReporter that logs uncaught exceptions. Wrap the given ExecutionContext.reportFailure or use UncaughtExceptionReporter.LogExceptionsToStandardErr for the default.

    Definition Classes
    SchedulerCompanionImpl
  15. def apply(executor: ScheduledExecutorService, ec: ExecutionContext): Scheduler

    Scheduler builder.

    Scheduler builder.

    executor

    is the ScheduledExecutorService that handles the scheduling of tasks into the future. If not provided, an internal default will be used. You can also create one with java.util.concurrent.Executors.

    ec

    is the execution context in which all tasks will run. Use scala.concurrent.ExecutionContext.Implicits.global for the default.

    Definition Classes
    SchedulerCompanionImpl
  16. def apply(executor: ScheduledExecutorService, ec: ExecutionContext, reporter: UncaughtExceptionReporter, executionModel: ExecutionModel): Scheduler

    Scheduler builder.

    Scheduler builder.

    The resulting Scheduler will piggyback on top of a Java ScheduledExecutorService for scheduling tasks for execution with a delay and a Scala ExecutionContext for actually executing the tasks.

    executor

    is the ScheduledExecutorService that handles the scheduling of tasks into the future. If not provided, an internal default will be used. You can also create one with java.util.concurrent.Executors.

    ec

    is the execution context in which all tasks will run. Use scala.concurrent.ExecutionContext.Implicits.global for the default.

    reporter

    is the UncaughtExceptionReporter that logs uncaught exceptions. Wrap the given ExecutionContext.reportFailure or use UncaughtExceptionReporter.LogExceptionsToStandardErr for the default.

    executionModel

    is the preferred ExecutionModel, a guideline for run-loops and producers of data. Use ExecutionModel.Default for the default.

    Definition Classes
    SchedulerCompanionImpl
  17. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  18. def cached(name: String, minThreads: Int, maxThreads: Int, keepAliveTime: FiniteDuration = 60.seconds, daemonic: Boolean = true, reporter: UncaughtExceptionReporter = LogExceptionsToStandardErr, executionModel: ExecutionModel = ExecModel.Default): SchedulerService

    Builds a Scheduler backed by an internal java.util.concurrent.ThreadPoolExecutor, that executes each submitted task using one of possibly several pooled threads.

    Builds a Scheduler backed by an internal java.util.concurrent.ThreadPoolExecutor, that executes each submitted task using one of possibly several pooled threads.

    name

    the created threads name prefix, for easy identification

    minThreads

    the number of threads to keep in the pool, even if they are idle

    maxThreads

    the maximum number of threads to allow in the pool

    keepAliveTime

    when the number of threads is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating

    daemonic

    specifies whether the created threads should be daemonic (non-daemonic threads are blocking the JVM process on exit).

    reporter

    is the UncaughtExceptionReporter that logs uncaught exceptions. Wrap the given ExecutionContext.reportFailure or use UncaughtExceptionReporter.LogExceptionsToStandardErr for the default.

    executionModel

    is the preferred ExecutionModel, a guideline for run-loops and producers of data. Use ExecutionModel.Default for the default.

    Definition Classes
    SchedulerCompanionImpl
  19. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. def computation(parallelism: Int = ..., name: String = "monix-computation", daemonic: Boolean = true, reporter: UncaughtExceptionReporter = LogExceptionsToStandardErr, executionModel: ExecutionModel = ExecModel.Default): SchedulerService

    Creates a Scheduler meant for computationally heavy CPU-bound tasks.

    Creates a Scheduler meant for computationally heavy CPU-bound tasks.

    Characteristics:

    - backed by a ForkJoinPool implementation, in async mode - uses monix's default ScheduledExecutorService instance for scheduling - DOES NOT cooperate with Scala's BlockContext

    parallelism

    is the number of threads that can run in parallel

    name

    the created threads name prefix, for easy identification.

    daemonic

    specifies whether the created threads should be daemonic (non-daemonic threads are blocking the JVM process on exit).

    reporter

    is the UncaughtExceptionReporter that logs uncaught exceptions. Wrap the given ExecutionContext.reportFailure or use UncaughtExceptionReporter.LogExceptionsToStandardErr for the default.

    executionModel

    is the preferred ExecutionModel, a guideline for run-loops and producers of data. Use ExecutionModel.Default for the default.

    Definition Classes
    SchedulerCompanionImpl
  21. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  23. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  24. def fixedPool(name: String, poolSize: Int, daemonic: Boolean = true, reporter: UncaughtExceptionReporter = LogExceptionsToStandardErr, executionModel: ExecutionModel = ExecModel.Default): SchedulerService

    Builds a Scheduler with a fixed thread-pool.

    Builds a Scheduler with a fixed thread-pool.

    Characteristics:

    - backed by a fixed pool ScheduledExecutorService that takes care of both scheduling tasks in the future and of executing immediate tasks - does not cooperate with Scala's BlockingContext, so tasks should not block on the result of other tasks scheduled to run on this same thread

    name

    the created threads name prefix, for easy identification.

    daemonic

    specifies whether the created thread should be daemonic

    reporter

    is the UncaughtExceptionReporter that logs uncaught exceptions.

    Definition Classes
    SchedulerCompanionImpl
  25. def forkJoin(parallelism: Int, maxThreads: Int, name: String = "monix-forkjoin", daemonic: Boolean = true, reporter: UncaughtExceptionReporter = LogExceptionsToStandardErr, executionModel: ExecutionModel = ExecModel.Default): SchedulerService

    Creates a general purpose Scheduler backed by a ForkJoinPool, similar to Scala's global.

    Creates a general purpose Scheduler backed by a ForkJoinPool, similar to Scala's global.

    Characteristics:

    - backed by a ForkJoinPool implementation, in async mode - uses monix's default ScheduledExecutorService instance for scheduling - cooperates with Scala's BlockContext

    parallelism

    is the number of threads that can run in parallel

    maxThreads

    is the maximum number of threads that can be created

    name

    the created threads name prefix, for easy identification.

    daemonic

    specifies whether the created threads should be daemonic (non-daemonic threads are blocking the JVM process on exit).

    reporter

    is the UncaughtExceptionReporter that logs uncaught exceptions. Wrap the given ExecutionContext.reportFailure or use UncaughtExceptionReporter.LogExceptionsToStandardErr for the default.

    executionModel

    is the preferred ExecutionModel, a guideline for run-loops and producers of data. Use ExecutionModel.Default for the default.

    Definition Classes
    SchedulerCompanionImpl
  26. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  27. def global: Scheduler

    The explicit global Scheduler.

    The explicit global Scheduler. Invoke global when you want to provide the global Scheduler explicitly.

    The default Scheduler implementation is backed by a work-stealing thread pool, along with a single-threaded ScheduledExecutionContext that does the scheduling. By default, the thread pool uses a target number of worker threads equal to the number of available processors.

    returns

    the global Scheduler

    Definition Classes
    SchedulerCompanionImpl → SchedulerCompanion
  28. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  29. def io(name: String = "monix-io", daemonic: Boolean = true, reporter: UncaughtExceptionReporter = LogExceptionsToStandardErr, executionModel: ExecutionModel = ExecModel.Default): SchedulerService

    Creates a Scheduler meant for blocking I/O tasks.

    Creates a Scheduler meant for blocking I/O tasks.

    Characteristics:

    - backed by a cached ThreadPool executor with 60 seconds of keep-alive - the maximum number of threads is unbounded, as recommended for blocking I/O - uses monix's default ScheduledExecutorService instance for scheduling - doesn't cooperate with Scala's BlockContext because it is unbounded

    name

    the created threads name prefix, for easy identification.

    daemonic

    specifies whether the created threads should be daemonic (non-daemonic threads are blocking the JVM process on exit).

    reporter

    is the UncaughtExceptionReporter that logs uncaught exceptions. Wrap the given ExecutionContext.reportFailure or use UncaughtExceptionReporter.LogExceptionsToStandardErr for the default.

    executionModel

    is the preferred ExecutionModel, a guideline for run-loops and producers of data. Use ExecutionModel.Default for the default.

    Definition Classes
    SchedulerCompanionImpl
  30. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  31. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  32. final def notify(): Unit
    Definition Classes
    AnyRef
  33. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  34. def singleThread(name: String, daemonic: Boolean = true, reporter: UncaughtExceptionReporter = LogExceptionsToStandardErr, executionModel: ExecutionModel = ExecModel.Default): SchedulerService

    Builds a Scheduler that schedules and executes tasks on its own thread.

    Builds a Scheduler that schedules and executes tasks on its own thread.

    Characteristics:

    - backed by a single-threaded ScheduledExecutorService that takes care of both scheduling tasks in the future and of executing tasks - does not cooperate with Scala's BlockingContext, so tasks should not block on the result of other tasks scheduled to run on this same thread

    name

    is the name of the created thread, for easy identification

    daemonic

    specifies whether the created thread should be daemonic (non-daemonic threads are blocking the JVM process on exit)

    reporter

    is the UncaughtExceptionReporter that logs uncaught exceptions. Wrap the given ExecutionContext.reportFailure or use UncaughtExceptionReporter.LogExceptionsToStandardErr for the default.

    executionModel

    is the preferred ExecutionModel, a guideline for run-loops and producers of data. Use ExecutionModel.Default for the default.

    Definition Classes
    SchedulerCompanionImpl
  35. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  36. def toString(): String
    Definition Classes
    AnyRef → Any
  37. def trampoline(underlying: Scheduler = Implicits.global, executionModel: ExecutionModel = ExecModel.Default): Scheduler

    Builds a TrampolineScheduler.

    underlying

    is the Scheduler to which the we defer to in case asynchronous or time-delayed execution is needed

    Definition Classes
    SchedulerCompanionImpl
  38. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. object Implicits extends schedulers.SchedulerCompanionImpl.ImplicitsLike
    Definition Classes
    SchedulerCompanionImpl → SchedulerCompanion

Inherited from Serializable

Inherited from Serializable

Inherited from SchedulerCompanionImpl

Inherited from SchedulerCompanion

Inherited from AnyRef

Inherited from Any

Ungrouped