Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public class

InheritableThreadLocal

extends ThreadLocal <T>
java.lang.Object
   ↳ java.lang.ThreadLocal <T>
     ↳ java.lang.InheritableThreadLocal<T>

Class Overview

A thread-local variable whose value is passed from parent to child thread. By default, the value of an inheritable thread-local variable of a child thread is initialized with the value of the parent thread's variable at thread creation time. However, subclasses may override {code #childValue(Object)} to provide an arbitrary function for passing the value of a parent's thread-local variable to the child's thread-local variable.

Summary

Public Constructors
InheritableThreadLocal ()
Creates a new inheritable thread-local variable.
Protected Methods
T childValue (T parentValue)
Computes the initial value of this thread-local variable for the child thread given the parent thread's value.
[Expand]
Inherited Methods
From class java.lang.ThreadLocal
From class java.lang.Object

Public Constructors

public InheritableThreadLocal ()

Added in API level 1

Creates a new inheritable thread-local variable.

Protected Methods

protected T childValue (T parentValue)

Added in API level 1

Computes the initial value of this thread-local variable for the child thread given the parent thread's value. Called from the parent thread when creating a child thread. The default implementation returns the parent thread's value.

Parameters
parentValue the value of the variable in the parent thread.
Returns
  • the initial value of the variable for the child thread.