Packages

final class ThreadLocal[A] extends AnyRef

Cross-platform equivalent for java.lang.ThreadLocal, for specifying thread-local variables.

These variables differ from their normal counterparts in that each thread that accesses one (via its ThreadLocal#get or ThreadLocal#set method) has its own, independently initialized copy of the variable.

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

Value Members

  1. def get(): A

    Returns the value in the current thread's copy of this thread-local variable.

    Returns the value in the current thread's copy of this thread-local variable. If the variable has no value for the current thread, it is initialized with the initial value specified in the constructor.

    returns

    the current thread's value of this thread-local

  2. val initial: A
  3. def reset(): Unit

    Removes the current thread's value for this thread-local variable.

    Removes the current thread's value for this thread-local variable. If this thread-local variable is subsequently read by the current thread, its value will be reinitialized by its initial value.

  4. def set(value: A): Unit

    Sets the current thread's copy of this thread-local variable to the specified value.

    Sets the current thread's copy of this thread-local variable to the specified value.

    value

    the value to be stored in the current thread's copy of this thread-local.