final class Local[A] extends LocalDeprecated[A]
A Local
is a ThreadLocal whose scope is flexible. The state
of all Locals may be saved or restored onto the current thread by
the user. This is useful for threading Locals through execution
contexts.
Because it's not meaningful to inherit control from two places, Locals don't have to worry about having to merge two contexts.
Note: the implementation is optimized for situations in which save and restore optimizations are dominant.
- Source
- Local.scala
- Alphabetic
- By Inheritance
- Local
- LocalDeprecated
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new Local(default: () => A)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- def :=(value: A): Unit
Alis for update.
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def apply(): A
Returns the current value of this
Local
. - final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def bind[R](value: A)(f: => R)(implicit R: CanBindLocals[R]): R
Execute a block with a specific local value, restoring the current state upon completion.
Execute a block with a specific local value, restoring the current state upon completion.
The implementation uses the CanBindLocals type class because in case of asynchronous data types that should be waited on, like
Future
orCompletableFuture
, then the locals context also needs to be cleared on the future's completion, for correctness. - def bindClear[R](f: => R)(implicit R: CanBindLocals[R]): R
Execute a block with the
Local
cleared, restoring the current state upon completion.Execute a block with the
Local
cleared, restoring the current state upon completion.The implementation uses the CanBindLocals type class because in case of asynchronous data types that should be waited on, like
Future
orCompletableFuture
, then the locals context also needs to be cleared on the future's completion, for correctness. - def clear(): Unit
Clear the Local's value.
Clear the Local's value. Other Locals are not modified.
General usage should be in Local.isolate to avoid leaks.
- def clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def get: A
Alias for apply.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val key: Key
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def update(value: A): Unit
Updates the value of this
Local
. - def value: Option[A]
Returns the current value of this
Local
, orNone
in case this local should fallback to the default.Returns the current value of this
Local
, orNone
in case this local should fallback to the default.Use apply in case automatic fallback is needed.
- def value_=(update: Option[A]): Unit
Updates the current value of this
Local
. - final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
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.catnap exposes pure abstractions built on top of the Cats-Effect type classes:
monix.eval is for dealing with evaluation of results, thus exposing Task and Coeval.
monix.reactive exposes the
Observable
pattern:Observable
implementationsmonix.tail exposes Iterant for purely functional pull based streaming:
Batch
andBatchCursor
, the alternatives to Scala'sIterable
andIterator
respectively that we are using within Iterant's encodingYou can control evaluation with type you choose - be it Task, Coeval, cats.effect.IO or your own as long as you provide correct cats-effect or cats typeclass instance.