final
class
Local[T] extends AnyRef
Instance Constructors
-
new
Local()
Value Members
-
final
def
!=(arg0: AnyRef): Boolean
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: AnyRef): Boolean
-
final
def
==(arg0: Any): Boolean
-
def
apply(): Option[T]
-
final
def
asInstanceOf[T0]: T0
-
def
clear(): Unit
-
def
clone(): AnyRef
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
def
let[U](value: T)(f: ⇒ U): U
-
def
letClear[U](f: ⇒ U): U
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
def
set(optValue: Option[T]): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
def
update(value: T): Unit
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Inherited from AnyRef
Inherited from Any
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.
Promises pass locals through control dependencies, not through data dependencies. This means that Locals have exactly the same semantics as ThreadLocals, if you think of
continue
(the asynchronous sequence operator) as semicolon (the synchronous sequence operator).Because it's not meaningful to inherit control from two places, Locals don't have to worry about having to merge two com.twitter.util.Local$.Contexts.
Note: the implementation is optimized for situations in which save and restore optimizations are dominant.