object Dispatcher

Source
Dispatcher.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Dispatcher
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

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. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. def parallel[F[_]](await: Boolean)(implicit arg0: kernel.Async[F]): kernel.Resource[F, Dispatcher[F]]

    Create a Dispatcher that can be used within a resource scope.

    Create a Dispatcher that can be used within a resource scope. Once the resource scope exits, depending on the termination policy all active effects will be canceled or awaited, and attempts to submit new effects will throw an exception.

    This corresponds to a pattern in which a single Dispatcher is being used by multiple calling threads simultaneously, with complex (potentially long-running) actions submitted for evaluation. In this mode, order of operation is not in any way guaranteed, and execution of each submitted action has some unavoidable overhead due to the forking of a new fiber for each action. This mode is most appropriate for scenarios in which a single Dispatcher is being widely shared across the application, and where sequencing is not assumed.

    The lifecycle of spawned fibers is managed by Supervisor. The termination policy can be configured by the await parameter.

    await

    the termination policy of the internal Supervisor.

    • true - wait for the completion of the active fibers
    • false - cancel the active fibers
    Note

    if an effect that never completes, is evaluating by a Dispatcher with awaiting termination policy, the termination of the Dispatcher is indefinitely suspended

    val io: IO[Unit] = // never completes
      Dispatcher.parallel[F](await = true).use { dispatcher =>
        dispatcher.unsafeRunAndForget(Concurrent[F].never)
        Concurrent[F].unit
      }
    See also

    Supervisor for the termination policy details

  16. def parallel[F[_]](implicit arg0: kernel.Async[F]): kernel.Resource[F, Dispatcher[F]]

    Create a Dispatcher that can be used within a resource scope.

    Create a Dispatcher that can be used within a resource scope. Once the resource scope exits, all active effects will be canceled, and attempts to submit new effects will throw an exception.

  17. def sequential[F[_]](await: Boolean)(implicit arg0: kernel.Async[F]): kernel.Resource[F, Dispatcher[F]]

    Create a Dispatcher that can be used within a resource scope.

    Create a Dispatcher that can be used within a resource scope. Once the resource scope exits, depending on the termination policy all active effects will be canceled or awaited, and attempts to submit new effects will throw an exception.

    This corresponds to a Dispatcher mode in which submitted actions are evaluated strictly in sequence (FIFO). In this mode, any actions submitted to Dispatcher.unsafeRunAndForget are guaranteed to run in exactly the order submitted, and subsequent actions will not start evaluation until previous actions are completed. This avoids a significant amount of overhead associated with the Parallel mode and allows callers to make assumptions around ordering, but the downside is that long-running actions will starve subsequent actions, and all submitters must contend for a singular coordination resource. Thus, this mode is most appropriate for cases where the actions are relatively trivial (such as Queue.offer) and the Dispatcher in question is not shared across multiple producers. To be clear, shared dispatchers in sequential mode will still function correctly, but performance will be suboptimal due to single-point contention.

    await

    the termination policy.

    • true - wait for the completion of the active fiber
    • false - cancel the active fiber
    Note

    if an effect that never completes, is evaluating by a Dispatcher with awaiting termination policy, the termination of the Dispatcher is indefinitely suspended

    val io: IO[Unit] = // never completes
      Dispatcher.sequential[IO](await = true).use { dispatcher =>
        dispatcher.unsafeRunAndForget(IO.never)
        IO.unit
      }
  18. def sequential[F[_]](implicit arg0: kernel.Async[F]): kernel.Resource[F, Dispatcher[F]]

    Create a Dispatcher that can be used within a resource scope.

    Create a Dispatcher that can be used within a resource scope. Once the resource scope exits, all active effects will be canceled, and attempts to submit new effects will throw an exception.

  19. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  20. def toString(): String
    Definition Classes
    AnyRef → Any
  21. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  22. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  23. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Deprecated Value Members

  1. def apply[F[_]](implicit arg0: kernel.Async[F]): kernel.Resource[F, Dispatcher[F]]
    Annotations
    @deprecated
    Deprecated

    (Since version 3.4.0) use '.parallel' or '.sequential' instead; the former corresponds to the current semantics of '.apply'

Inherited from AnyRef

Inherited from Any

Ungrouped