Java.lang.InheritableThreadLocal Class



The java.lang.InheritableThreadLocal class extends ThreadLocal to provide inheritance of values from parent thread to child thread: when a child thread is created, the child receives initial values for all inheritable thread-local variables for which the parent has values.

Class Declaration

Following is the declaration for java.lang.InheritableThreadLocal class −

public class InheritableThreadLocal<T>
   extends ThreadLocal<T>

Class constructors

S.N. Constructor & Description

public class InheritableThreadLocal<T>extends ThreadLocal<T>

This is the Single Constructor.

Class methods

S.N. Method & Description

protected T childValue(T parentValue)

This method computes the child's initial value for this inheritable thread-local variable as a function of the parent's value at the time the child thread is created.

Methods inherited

This class inherits methods from the following classes −

  • java.lang.ThreadLocal
  • java.lang.Object