final class Local[A] extends AnyRef
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.
- Alphabetic
- By Inheritance
- Local
- 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): R
Execute a block with a specific local value, restoring the current state upon completion.
-
def
bindClear[R](f: ⇒ R): R
Execute a block with the
Local
cleared, restoring the current state upon completion. -
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
- @native() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): 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[_]
- 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( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )